Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix latin-1-ization of Title in eps. #12869

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
Nov 23, 2018
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 23, 2018

We want title to be latin-1-encodable, so decoding it as utf-8 (the
default) won't work (if there are characters with the highest bit set).

Closes #11130 (comment); release critical as a regression (due to #11130, which fixed the case of filenames which are not latin-1...).

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

We want `title` to be latin-1-encodable, so decoding it as utf-8 (the
default) won't work (if there are characters with the highest bit set).
@anntzer anntzer added the Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. label Nov 23, 2018
@anntzer anntzer added this to the v3.0.3 milestone Nov 23, 2018
@wilfriedh
Copy link

I did some tests. Probably the line should read
title = title.encode("ASCII", "replace").decode('ASCII')
which would keep all ASCII characters as such, translate all non-ASCII characters to "?" and fully conform to the PostScript standard [1], which reads:

The standard character set for ASCII-encoded PostScript programs is the visible printable subset of the ASCII character set, plus characters that appear as "white space," such as space, tab, and newline characters. ... ASCII encoding does not prohibit the use of characters outside this set, but such use is not recommended, because it impairs portability and may make transmission and storage of PostScript programs more difficult.

[1] PostScript® Language Reference, Third Edition, Addison-Wesley, 1999, page 26
https://www.adobe.com/content/dam/acom/en/devnet/actionscript/articles/PLRM.pdf
on page https://www.adobe.com/devnet/postscript.html

@anntzer
Copy link
Contributor Author

anntzer commented Nov 23, 2018

See also #11130 (comment) for more exegesis of the standard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants