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
[1.5] Allow oc_ modules to pass unicode results #4098
[1.5] Allow oc_ modules to pass unicode results #4098
Conversation
|
aos-ci-test |
|
We need some test data that has unicode characters to actually exercise this. |
|
Also, it does not really work: We need to actually deal with errors: |
|
When it comes to random data I think @mtnbikenc @enj thoughts? |
|
I don't think we'll encounter any random data so this should be sufficient. >>> beef = "ÐÊÄÐ-ßÈËF"
>>> beef.decode()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 0: ordinal not in range(128)
>>> beef.decode('utf-8')
>>> print beef.decode('utf-8')
ÐÊÄÐ-ßÈËF |
|
Added the unicode used in @abutcher's example to a file, and used subprocess to check out In [1]: import subprocess
In [2]: p = subprocess.Popen(["cat", "data"], stdout=subprocess.PIPE)
In [3]: o, e = p.communicate()
In [4]: o
Out[4]: b'\xc3\x90\xc3\x8a\xc3\x84\xc3\x90-\xc3\x9f\xc3\x88\xc3\x8bF\n'
In [5]: o.decode('utf-8')
Out[5]: 'ÐÊÄÐ-ßÈËF\n'
In [6]: |
Backports #4089
Fixes bug 1444806
Fixes bug 1446471