Skip to content
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: use b'' when escaping array as strings in ps #6282

Merged
merged 1 commit into from Apr 8, 2016

Conversation

tacaswell
Copy link
Member

The function quote_ps_string is used to sanitize the result of
np.tostring (which really returns bytes) to make sure no 'special'
ps characters make it through.

We were trying to use unicode to replace in a byte string

We also need to decode bytes to unicode to put the string into the
ps file.

closes #6226

The function quote_ps_string is used to sanitize the result of
np.tostring (which really returns bytes) to make sure no 'special'
ps characters make it through.

We were trying to use unicode to replace in a byte string

We also need to decode bytes to unicode to put the string into the
ps file.

closes matplotlib#6226
@tacaswell tacaswell added this to the 1.5.2 (Critical bug fix release) milestone Apr 8, 2016
@mdboom
Copy link
Member

mdboom commented Apr 8, 2016

We also need to decode bytes to unicode to put the string into the
ps file.

That's probably fine to get this working for now, but PS is an 8-bit format (completely non-unicode aware), so ideally we wouldn't return strings from this. This makes it more convenient because the default open works on Python 3, but the user could theoretically end up encoding to some weird unicode encoding in the file this way, when it really should be bytes all the way down.

@mdboom mdboom merged commit 56dd604 into matplotlib:v1.5.x Apr 8, 2016
@tacaswell tacaswell deleted the fix_ps_string_escaping branch May 12, 2016 21:43
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.

None yet

2 participants