-
Notifications
You must be signed in to change notification settings - Fork 12
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
Fix missing encoding for Windows with non-utf-8 code page #45
base: master
Are you sure you want to change the base?
Conversation
Code page number is obtained once at ctor of the ConsoleCohesionEventHandler. The change applies only to Windows OS. For other OS the encoding remains the same "utf-8".
Well done! I met the same problem and solved it with this method. |
@Michaelmlh could you please give some examples of what results |
@anion0278 |
Maybe you should get the numeric part of the returned string, and it will avoid the first part of the string |
Thanks for pointing out this case! I will try to solve the issue using Regex, something like |
@Michaelmlh I have incorporated changes in order to make it more universal. Could you, please, test it on your machine? |
@anion0278 |
This change specifies the code page for string decoding in Windows. When using
decode()
without theencoding
parameter on Windows machine with non-utf-8 encoding ("Region - Language for non-Unicode programs" for examplecp852
) the following exceptions occur:Code page number is obtained once at ctor of the
ConsoleCohesionEventHandler
. The change applies only to Windows OS.For other platforms the encoding remains the same
utf-8
.The reason for acquiring the codepage through the
subprocess
is thatsys.stdout.encoding
incorrectly returnsutf-8
, while the actual encoding is different.This should represent a simple fix for the following issues:
ms-iot/ROSOnWindows#214 (comment)
ros2/ros2_documentation#654
https://answers.ros.org/question/351567/ros2-colon-building-turtlesim-package-failed/