-
Notifications
You must be signed in to change notification settings - Fork 186
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
The parser IniConfigFile runs into exceptions when the ini file contains Chinese or Japanese strings #3450
Comments
This is caused by the following basic definition of the insights-core/insights/parsr/__init__.py Lines 1252 to 1254 in bbc2186
The >>> string.printable
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c' Since the IniConfigFile allows to use of other languages, like Chinese, Japanese, and Korean in the String value, I think It's necessary to add the characters from these languages to the What's your idea, @bfahr, @ryan-blakley ? |
I like the idea that @koalakangaroo shared with me: we may replace these This a quite good approach for us to quickly fix this issue, I think it's feasible, just like IP obfuscation that we do during the collection. @bfahr, @ryan-blakley, Thoughts? |
@xiangce after playing around with the symbols I did find that the unidecode python module can convert to the unicode characters to ascii characters. But it seems that module isn't available in RHEL. You mentioned replacing the characters do you know of an easier way to replace unicode characters? |
@ryan-blakley - Nope, I have no idea about this either. And I'm also not sure if the
|
@xiangce - Yeah I noticed the space that was another reason I figured it wouldn't work. If you're good with replacing, I think the below may work then.
|
* Iniparser is only setup to parse string.printable characters. This doesn't include non ascii characters from various languages, which causes an exception when they're in a config file. So replace the characters with question marks. * Fixes #3450 Signed-off-by: Ryan Blakley <[email protected]>
* Iniparser is only setup to parse string.printable characters. This doesn't include non ascii characters from various languages, which causes an exception when they're in a config file. So replace the characters with question marks. * Fixes #3450 Signed-off-by: Ryan Blakley <[email protected]> (cherry picked from commit 1fe7320)
* Iniparser is only setup to parse string.printable characters. This doesn't include non ascii characters from various languages, which causes an exception when they're in a config file. So replace the characters with question marks. * Fixes #3450 Signed-off-by: Ryan Blakley <[email protected]>
For the example ini file:
The parser IniConfigFile runs into the following exceptions when parsing the above ini file:
The text was updated successfully, but these errors were encountered: