Comments (5)
I finally got back to this and it seems to work ok, at least for NI-DCPower.
from grpc-device.
Related, the test QuotedLocalizedDescription_ApiErrorAndDescriptionToStatus_MessageIsEncoded
is not behaving in a sufficiently predictable way that meets everyone's expectations. While I'm baffled by the nuances of non-ANSI characters in C string constants, @bkeryan and Ben Craig are not convinced the code is doing anything to encode the characters.
- Brad thought the constant
std::string("\"chaîne localisée 😀\"")
in MSVC would issue a code page warning, but I can confirm it does not. - I tried making the constant explicitly specify
u8
encoding, but Ben pointed out that code would cease to compile when we move to a newer C++ standard. - I tried keeping a "normal" C string and using explicit Unicode characters
std::string("\"cha\u00EEne localis\u00E9e\U0001F600\"")
but that causes 2 problems:- Compiling:
warning C4566: character represented by universal-ch aracter-name '\U0001F600' cannot be represented in the current code page (1252)
- Running:
C++ exception with description "[json.exception.type_error.316] invalid UTF-8 byte at index 5: 0x6E" thrown in the test body
- Compiling:
The last part is the most concerning to me, as I would expect either inserting into the JSON object or stringifying it would take care of the encoding, but it doesn't seem to be the case. This likely needs to be addressed as part of solving this problem.
Also see Brad's comments here and here.
from grpc-device.
Long story short, MSVC has two character sets: source and execution. It uses the source character set to read the .cpp
file and it uses the execution character set to write string constants to .obj
files. By default, both character sets are ANSI. If you want to specify UTF-8 string constants using UTF-8 source code, you should set both character sets to UTF-8.
Brad thought the constant std::string(""chaîne localisée 😀"") in MSVC would issue a code page warning, but I can confirm it does not.
It depends on the code page and the character values. Some sequences of Windows-1252 (Latin-1) characters or UTF-8 bytes are not valid Windows-932 (simplified Chinese) byte sequences. Depending on the characters used, this may generate warnings when compiling with a Chinese locale.
Compiling: warning C4566: character represented by universal-ch aracter-name '\U0001F600' cannot be represented in the current code page (1252)
This confirms that the execution character set is Windows-1252. This code page cannot represent emoji.
Running: C++ exception with description "[json.exception.type_error.316] invalid UTF-8 byte at index 5: 0x6E" thrown in the test body
MSVC converted \u00EE
to the Windows-1252 representation of 'î' and the resulting Windows-1252 byte sequence is not a valid UTF-8 byte sequence.
u8"\u00EE"
would work, except for the C++20 changes.
"\xC3\xAE"
should work regardless of source/execution encodings or language standard.
from grpc-device.
@bkeryan , are you good with marking this Issue closed? I'm good with the changes in the PR + tests that ran and the additional issue David made to capture the additional work to use the better suited DAQmx DLL.
But you're more of the expert with this issue so wanted to check with you to see if you're good with closing it too.
from grpc-device.
I'd like to do a little testing to see if the system as a whole handles i18n properly.
from grpc-device.
Related Issues (20)
- Intermittent Test: FGEN test AllocateNamedWaveform_WriteNamedWaveformF64_WaveformWrittenSuccessfully HOT 1
- Code generation could be more efficient for simple 'repeated' types
- Review and merge request for new page in Wiki
- Update Linux RT Feed to point to new release 2.4.0
- Update Linux RT Feed to point to new release 2.5.0
- Intermittent Test: NiFgenSessionTest.InitializedSession_CloseSession_ClosesDriverSession HOT 2
- Windows system test runner occasionally hits timeout HOT 1
- Addon metadata isn't merged by the build HOT 1
- Update Linux RT Feed to point to new release 2.2.0
- Remove SetRuntimeEnvironment override from nidcpower metadata upon metadata update
- Remove SetRuntimeEnvironment override from nidmm metadata upon metadata update
- Remove SetRuntimeEnvironment override from nidigital metadata upon metadata update
- Remove SetRuntimeEnvironment override from nifake metadata upon metadata update
- Remove SetRuntimeEnvironment override from nifgen metadata upon metadata update
- Remove SetRuntimeEnvironment override from niscope metadata upon metadata update
- Remove SetRuntimeEnvironment override from niswitch metadata upon metadata update
- Intermittent Test: NiRFmxInstrDriverApiTests.GetNIRFSASession_SelfTest_Succeeds
- Intermittent Test: NiRFmxWCDMADriverApiTests.ModAccMarkerModeFromExample_FetchData_DataLooksReasonable
- Intermittent Test: NiFgenDriverApiTest.SetAttributeViBoolean_GetAttributeViBoolean_ValueMatches HOT 1
- Update Linux RT Feed to point to new release 2.3.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-device.