ADBDEV-9459: Fix handling unicode characters in commands result#2258
Closed
KnightMurloc wants to merge 2 commits intoadb-6.xfrom
Closed
ADBDEV-9459: Fix handling unicode characters in commands result#2258KnightMurloc wants to merge 2 commits intoadb-6.xfrom
KnightMurloc wants to merge 2 commits intoadb-6.xfrom
Conversation
The result of some commands may contain unicode characters, which leads to a UnicodeDecodeError when trying to cast it to str in Python 2. Also remove the futurize changes from the pexpect module since this module already supports Python 3.
ShapatinAA
reviewed
Mar 18, 2026
| if GV.opt['-v']: | ||
| print('[Info]', strcmd(c)) | ||
| p = subprocess.Popen(c, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) | ||
| out = p.stdout.read(-1).decode('utf-8') |
There was a problem hiding this comment.
Why there will not be problems on python3?
Author
There was a problem hiding this comment.
>>> "{}".format("test".encode('utf-8'))
"b'test'"
It may not look that good, but it won't lead to an error. I'm not sure if it's worth adding branching here.
There was a problem hiding this comment.
What the problem with branching? If we get ugly output under python3, is it normal?
Author
There was a problem hiding this comment.
This makes the code less readable. But I'm not sure.
There was a problem hiding this comment.
not good, right
>>> "{}".format("test привет".encode('utf-8'))
"b'test \\xd0\\xbf\\xd1\\x80\\xd0\\xb8\\xd0\\xb2\\xd0\\xb5\\xd1\\x82'
This comment was marked as resolved.
This comment was marked as resolved.
hilltracer
approved these changes
Mar 19, 2026
Author
|
Fixed with other approach in #2259 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The result of some commands may contain unicode characters, which leads to a
UnicodeDecodeError when trying to cast it to str in Python 2. Also remove the
futurize changes from the pexpect module since this module already supports
Python 3.