Skip to content

checker: replace warning by notice for UTF8 strings validation #24543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 21, 2025

Conversation

lcheylus
Copy link
Contributor

@lcheylus lcheylus commented May 21, 2025

Fix #24538


Tests OK on Linux (Debian/amd64)

$ ./v -stats -W test vlib/encoding/utf8/validate/encoding_utf8_test.v
---- Testing... ----------------------------------------------------------------------------------------------------------------------------
vlib/encoding/utf8/validate/encoding_utf8_test.v:6:36: notice: invalid utf8 string, please check your file's encoding is utf8
    4 |     assert validate.utf8_string('añçá') == true
    5 |     assert validate.utf8_string('\x61\xC3\xB1\xC3\xA7\xC3\xA1') == true
    6 |     assert validate.utf8_string('\xC0\xC1') == false
      |                                       ~~~~
    7 |     assert validate.utf8_string('\xF5\xFF') == false
    8 |     assert validate.utf8_string('\xE0\xEF') == false
vlib/encoding/utf8/validate/encoding_utf8_test.v:7:36: notice: invalid utf8 string, please check your file's encoding is utf8
    5 |     assert validate.utf8_string('\x61\xC3\xB1\xC3\xA7\xC3\xA1') == true
    6 |     assert validate.utf8_string('\xC0\xC1') == false
    7 |     assert validate.utf8_string('\xF5\xFF') == false
      |                                       ~~~~
    8 |     assert validate.utf8_string('\xE0\xEF') == false
    9 | }
vlib/encoding/utf8/validate/encoding_utf8_test.v:8:36: notice: invalid utf8 string, please check your file's encoding is utf8
    6 |     assert validate.utf8_string('\xC0\xC1') == false
    7 |     assert validate.utf8_string('\xF5\xFF') == false
    8 |     assert validate.utf8_string('\xE0\xEF') == false
      |                                       ~~~~
    9 | }
checker summary: 0 V errors, 0 V warnings, 3 V notices
        V  source  code size:      29945 lines,     137986 tokens,     804318 bytes,   286 types,    13 modules,   134 files
generated  target  code size:       9980 lines,     352219 bytes
compilation took: 338.826 ms, compilation speed: 88378 vlines/s, cgen threads: 7
running tests in: /home/fox/dev/vlang.git/vlib/encoding/utf8/validate/encoding_utf8_test.v
      OK       0.005 ms     5 asserts | main.test_validate_str()
     Summary for running V tests in "encoding_utf8_test.v": 5 passed, 5 total. Elapsed time: 0 ms.

 OK     358.708 ms vlib/encoding/utf8/validate/encoding_utf8_test.v
--------------------------------------------------------------------------------------------------------------------------------------------
Summary for all V _test.v files: 1 passed, 1 total. Elapsed time: 360 ms, on 1 job. Comptime: 0 ms. Runtime: 358 ms.

Copy link

Connected to Huly®: V_0.6-22910

@lcheylus
Copy link
Contributor Author

Force new push => forgot to modify output for vlib/v/checker/tests/invalid_utf8_string.vv test used by vlib/v/compiler_errors_test.v

@spytheman
Copy link
Member

Excellent work. A note is indeed better than a warning for this.

@spytheman spytheman merged commit a5c8b4f into vlang:master May 21, 2025
74 checks passed
@lcheylus lcheylus deleted the validate_utf8 branch May 21, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Errors with validation of UTF8 strings
2 participants