Skip to content

Bytes representation changed from hex to utf-8 #246

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

Merged
merged 1 commit into from
Jan 2, 2019

Conversation

rmliddle
Copy link
Contributor

@rmliddle rmliddle commented Jan 2, 2019

Tiny change to make things most consistent with python:

Previous Behaviour:

>>>>> b = b'abc'
>>>>> b
b'\x61\x62\x63'

Python 3:

>>> b = b'abc'
>>> b
b'abc'

let data: Vec<String> = data.iter().map(|b| format!("\\x{:02x}", b)).collect();
let data = data.join("");
let value = get_value(obj);
let data = String::from_utf8(value.to_vec()).unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it probably depends upon the exact ascii character whether or not it is printed as hex character.

@windelbouwman windelbouwman merged commit a28b665 into RustPython:master Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants