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

Savefig to EPS with cyrillic title doesn't work #2684

Closed
PAleksandrov opened this issue Dec 14, 2013 · 3 comments
Closed

Savefig to EPS with cyrillic title doesn't work #2684

PAleksandrov opened this issue Dec 14, 2013 · 3 comments
Milestone

Comments

@PAleksandrov
Copy link

Saving a figure with cyrillic title doesn't work. The next message is printed:

savefig('/tmp/тест.eps')
Traceback (most recent call last):
File "/opt/develop/lib/python3.3/site-packages/ipython-1.1.0-py3.3.egg/IPython/core/interactiveshell.py", line 2828, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
savefig('/tmp/тест.eps')
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/pyplot.py", line 561, in savefig
return fig.savefig(_args, *_kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/figure.py", line 1411, in savefig
self.canvas.print_figure(_args, *_kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backends/backend_qt4agg.py", line 161, in print_figure
FigureCanvasAgg.print_figure(self, _args, *_kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backend_bases.py", line 2220, in print_figure
*_kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backend_bases.py", line 1947, in print_eps
return ps.print_eps(_args, *_kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 979, in print_eps
return self._print_ps(outfile, 'eps', *args, *_kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 1007, in _print_ps
**kwargs)
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 1199, in _print_figure
print_figure_impl()
File "/opt/develop/lib/python3.3/site-packages/matplotlib-1.4.x-py3.3-linux-x86_64.egg/matplotlib/backends/backend_ps.py", line 1117, in print_figure_impl
if title: print("%%Title: "+title, file=fh)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 14-17: ordinal not in range(128)

If EPS format doesn't allow writing titles in non-ascii encodings, it may be better to leave an empty title.

@mdboom
Copy link
Member

mdboom commented Dec 16, 2013

It is True that the metadata in Postscript is ascii (and the text itself isn't really Unicode either, but you can get a little farther with various hacks). We could use title.encode('ascii', 'replace') here. Does that successfully create a file for you?

@PAleksandrov
Copy link
Author

16.12.2013 18:21, Michael Droettboom пишет:

We could use |title.encode('ascii', 'replace')| here. Does that
successfully create a file for you?


Reply to this email directly or view it on GitHub
#2684 (comment).

I think that yes.

@tacaswell tacaswell added the text label Aug 17, 2014
@tacaswell tacaswell added this to the v1.4.x milestone Aug 17, 2014
@tacaswell
Copy link
Member

Closing as there is a work around and this seems to be a limitation of eps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants