Skip to content

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

Merged
spytheman merged 1 commit into
vlang:masterfrom
lcheylus:validate_utf8
May 21, 2025
Merged

spytheman merged 1 commit into
vlang:masterfrom
lcheylus:validate_utf8

Conversation

@lcheylus

@lcheylus lcheylus commented May 21, 2025 •

Copy link
Copy Markdown
Contributor

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.

@huly-for-github

Copy link
Copy Markdown

Connected to Huly®: V_0.6-22910

Signed-off-by: Laurent Cheylus <foxy@free.fr>
@lcheylus

Copy link
Copy Markdown
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
Copy Markdown
Contributor

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

@spytheman
spytheman merged commit a5c8b4f into vlang:master May 21, 2025
@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