-
Notifications
You must be signed in to change notification settings - Fork 266
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
Bad encoding of end of line characters #2938
Comments
I'm not so sure this is an error ... This needs some thorough thought though :-) |
I understand the problem is in the round trip. I mean, if a given attribute at CB has been set to:
what the user wants to be retrieved is
and not
which, in addition, is ilegal JSON (have a look with https://jsonlint.com) |
Thanks @fgalan, that's the point. In JSON the character with value 10 (0xA, line feed) is encoded as |
Reading a little about this, i.e. it seems that orion should modify the incoming one byte A bit strange to modify the value that the user has given ... Same same with the other 8 permitted escape sequences, presented here: http://json.org/ |
Not sure... In fact, given that one-byte-\n is illegal JSON, CB should return a "Illegal JSON" error. In fact, it is not working right now in that way? Is not rapidjson detecting that as illegal JSON? I think the fix should be in the other direction. I mean, assuming that we have (in the DB) two bytes \ and n what we should return is two bytes \ and n, not one byte newline (as I understand is happening right now). |
I don't know the internals of Orion, but in the
As you can see, there is a difference of two bytes in the |
ok, makes sense, We need to look into this to understand what is really happening. |
@aarranz , how does the entity look like in the DB in both cases? I mean, |
Orion allows to insert end of line characters inside string values of attributes, and that is working as expected. But the context broker is not correctly encoding back that EOL characters, that results in invalid JSON response from the context broker.
Example:
The same happens to the ' \r' character used also as EOL character.
Tested with:
The text was updated successfully, but these errors were encountered: