Skip to content
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

Invalid utf8 string warning in '\xc0' literal #23741

Open
mike-ward opened this issue Feb 16, 2025 · 3 comments
Open

Invalid utf8 string warning in '\xc0' literal #23741

mike-ward opened this issue Feb 16, 2025 · 3 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@mike-ward
Copy link
Contributor

mike-ward commented Feb 16, 2025

Describe the bug

v -e "println('\xc0')"
01JM7GKNS7A628B6A71RG4R7EW.vsh:1:12: warning: invalid utf8 string, please check your file's encoding is utf8
    1 | println('\xc0')
      |            ~~~

Reproduction Steps

see description

Expected Behavior

Should not produce warning.

Current Behavior

see description

Possible Solution

From Discord:

JalonSolov — Yesterday at 5:49 PM
This is likely the culprit... just merged today... #23721

Additional Information/Context

tcn — Yesterday at 5:20 PM
ran this in termux
same error

V version

V 0.4.9 2015aa3

Environment details (OS name and version, etc.)

V full version V 0.4.9 da3112e.2015aa3
OS macos, macOS, 15.3, 24D60
Processor 8 cpus, 64bit, little endian, Apple M2
Memory 0.17GB/8GB
V executable /Users/mike/Documents/github/v/v
V last modified time 2025-02-16 13:45:01
V home dir OK, value: /Users/mike/Documents/github/v
VMODULES OK, value: /Users/mike/.vmodules
VTMP OK, value: /tmp/v_501
Current working dir OK, value: /Users/mike/Documents/github/kite
Git version git version 2.48.1
V git status weekly.2025.06-61-g2015aa3c
.git/config present true
cc version Apple clang version 16.0.0 (clang-1600.0.26.6)
gcc version Apple clang version 16.0.0 (clang-1600.0.26.6)
clang version Apple clang version 16.0.0 (clang-1600.0.26.6)
tcc version tcc version 0.9.28rc 2024-02-05 HEAD@105d70f7 (AArch64 Darwin)
tcc git status thirdparty-macos-arm64 713692d4
emcc version N/A
glibc version N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@mike-ward mike-ward added the Bug This tag is applied to issues which reports bugs. label Feb 16, 2025
Copy link

Connected to Huly®: V_0.6-22157

@spytheman
Copy link
Member

@kbkpbot, @medvednikov what are your opinions on that?

Should V's literals be checked at compile time, to contain only valid utf8 sequences, or not?

@kbkpbot
Copy link
Contributor

kbkpbot commented Feb 19, 2025

Because V's string encoding in UTF8 default, I think it is user's responsibility to make sure their string literals are valid utf8 sequences.
I think we should keep this warning message.

If user try to build a string with invalid UTF8 sequence, he can first use a []u8 construct the string, and then use something like tos convert it to V's string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

3 participants