-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
VS2017 build warning C4819 on non-english code page. #85
Comments
Which character was the compiler complaining about? |
I found two position.
abseil-cpp/absl/strings/str_split_test.cc Lines 622 to 642 in 46ed9d9
After modify these two file, the build success. |
Since Abseil is fairly low-level, instead of forcing utf-8 in msvc builds, I think the correct move is to make our source files all ascii. So I'll write up a patch to change that test to use unicode escape characters, which should make it agnostic to file encoding. That being said, Abseil files are utf8 internally, so I'm not sure what other monsters there may be lurking if someone tries to use abseil source with other encodings. |
It make sense, it's better make source file as ascii than forcing utf-8 for msvc. Thanks |
Note that the test is actually testing utf8 characters. I don't see how we can have a test for utf8 in ASCII ... We should definitely prefer ASCII for source files, IMO, but I'm not sure requiring them to be ASCII is the best option. |
Jon and I chatted about this yesterday, and I came to the conclusion that Abseil files should be ASCII. Abseil strives to be as broadly usable as possible. Usually this takes the form of writing code that works on a wide variety of platforms, dodging bugs in those platforms if necessary. Here it means avoiding UTF-8 because some toolchains we want to support can't handle it. The alternative isn't as bad as I feared: escaping the unicode characters in the test strings lets them be UTF-8 test strings that are specified using only ASCII characters in the source code. I'm a little sad, because suddenly it's no longer clear at a glance that the escaped characters are well-formed UTF-8, but this feels like the right thing to do to me. |
The MSVC error message says "Save the file in Unicode format to prevent data loss" Just curious: What does it mean to save the file in Unicode format? Does it just add a UTF-8 BOM to the beginning of the file? Or is there additional metadata in the filesystem to tell MSVC that the file is Unicode? |
"Unicode format" seems ambiguous. Anyways it looks like my internal patch to remove non-ascii characters has been upstreamed, and ASCII fits in all flavors of Unicode. Is this problem still persisting? |
Try to build 0ec11ba ,
It just test, maybe I should ignore it. |
I'm looking into fixing the |
This has been fixed internally; just waiting for the change to be propagated to GitHub. |
I just pushed the change to GitHub. |
Hello, I'm trying to build abseil-cpp on Windows with installed VS 2017. My default code page is 936 (Simplified Chinese) and when build abseil will occur following error.
Here is one solution. Add
/utf-8
option toMSVC_FLAGS
in fileabsl/copts.bzl
The text was updated successfully, but these errors were encountered: