Skip to content
This repository has been archived by the owner on Jul 19, 2022. It is now read-only.

Unicode characters puts nulls into string under Windows #37

Open
bpeikes opened this issue Jul 25, 2014 · 3 comments
Open

Unicode characters puts nulls into string under Windows #37

bpeikes opened this issue Jul 25, 2014 · 3 comments

Comments

@bpeikes
Copy link

bpeikes commented Jul 25, 2014

It looks like there is an issue when using this under Windows and there are unicode characters. The code in parse_string does not appear to work. It might be due to the implementation of stringstream.

In the code for parse_string, there is the following code:

case 'u':
int i;
std::stringstream ss;
for( i = 0; (!input.eof() && input.good()) && i < 4; ++i ) {
input.get(ch);
ss << ch;
}
if( input.good() && (ss >> i) )
value.push_back(i);

Using Visual Studio 2013, ss >> i, on the stream "000d" makes i == 0, which means that there are embedded nuls. I'm not even sure what (ss >> i) is supposed to return when cast to a bool.

@Rapptz
Copy link
Contributor

Rapptz commented Jul 25, 2014

ss >> i is supposed to return the state of the stream. Not the extracted character. So ss >> i should return true regardless of whether or not there are embedded nulls.

@bpeikes
Copy link
Author

bpeikes commented Jul 29, 2014

I'm not sure what the issue is then. I'll have to double check. The issue I'm having is that when I step through the code I'm getting nulls added to value.

@r-lyeh-archived
Copy link
Contributor

"\u000d" should parse integer to 0x0d according other utf-8 escaped tests.
we could add this case to the escaped utf-8 tests and ensure it is not broken at the moment

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants