-
Notifications
You must be signed in to change notification settings - Fork 193
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
[rqd] Fix non ASCII chars #1335
base: master
Are you sure you want to change the base?
[rqd] Fix non ASCII chars #1335
Conversation
Convert to ASCII while discarding characters that can not be encoded
ProblemBefore, if the RQD logs with non-ASCII text, the RQD crashes and the CueGUI shows the process as running for a long time. ErrorUnicodeEncodeError: 'ascii' codec can't encode character u'\u221e' in position 64: ordinal not in range(128) The problem is on the pipe_to_file function when trying to output non-ASCII characters to the file. Error happens in the code below:
SolutionBEFORE
NEW SOLUTION
About the bug fixNow, the RQD will ignore characters non-ascii in the logs and the RQD will work correctly. For example: If the log is: It will be: It will ignore the Korean character '영화' and the 'é'. Tests
|
Other solutionsReplace non-ASCII character with '?'
Current solution
Solution using .encode('ascii', 'replace')
Encode with UTF-8, instead of ASCIIIt is also possible to keep UTF-8, but use encode() and decode(): UTF-8 example
ASCII example
|
- Convert to ASCII while discarding characters that can not be encoded - Update sphinx version to 5.0.0 on docs/requirements.txt
- Convert to ASCII while discarding characters that can not be encoded - Update sphinx version to 5.0.0 on docs/requirements.txt - Change docs/conf.py to use language = 'en'
@@ -1219,6 +1219,8 @@ def print_and_flush_ln(fd, last_timestamp): | |||
|
|||
remainder = lines[-1] | |||
for line in lines[0:-1]: | |||
# Convert to ASCII while discarding characters that can not be encoded | |||
line = line.encode('ascii', 'ignore') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramonfigueiredo Thank you for the PR and the detailed write up. The detail makes it nice and easy to review with the proper context.
So, this error occurs when we intercept output in order to prepend a timestamp. What is logged to the file when RQD_PREPEND_TIMESTAMP
is False
?
My sense is that the output which is logged when RQD_PREPEND_TIMESTAMP
is True
vs False
should be as similar as possible, aside from the timestamp of course.
Removing changes to update Sphinx version
Convert to ASCII while discarding characters that can not be encoded