-
Notifications
You must be signed in to change notification settings - Fork 11
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
caPutJsonLog may send invalid JSON #9
Comments
I take it you mean at runtime? Is it realistic to instead convert string constants in the relevant source files to UTF-8? It seems to me that this would be the only realistic way to escape from the N+1 nature of character encoding standards. |
It looks like the Pandora's Box of the IOC's character encoding is getting opened, whether we like it or not.
|
Michael, the problem is not string constants but user provided run time strings set with caput from a terminal with other encoding than utf-8. |
When writing non utf-8 characters to a field that is logged, e.g. German äöü or µ or ° from a terminal in ISO-8859-1 encoding, these non utf-8 bytes (0x80 ... 0xff) are copied into the JSON string without any checks or conversions. The resulting erroneous JSON may be impossible to parse for a JSON compliant logger.
What to do?
a) Convert to utf-8, assuming some encoding, e.g. iso-8859-1, which is relatively easy, other encodings are more tricky.
b) skip those bytes
c) replace them with some "special" character
The text was updated successfully, but these errors were encountered: