Comments (9)
I can't get enough information from your issue report. And how you get to
the error.
I have nevertheless tested using Unicode in the examples and it worked. My
name in the license comment has also non ascii characters. Maybe making
sure your files have Unicode encoding and you have on top of the file the
encoding comment.
I remember there was already an issue or pr for Unicode support #18 #19.
But for python 2. Which is not your case.
There was also the discussion of enforcing ascii characters in code.
The case for searchindex.js is when resolving the links for the modules of
your project. Meaning you have the non ascii characters in your modules,
and sphinx is not saving the index in Unicode(which is unexpected, even
more in python 3) but this is out of our scope of control.
from sphinx-gallery.
This problem is originated by me.
I'm running sphinx with Python 3.4.1
I have an authors name with the umlaut ΓΌ in a readme.rst (utf-8 encoded).
I don't knwo why .. but sphinxgallery/docs_resolv.py:48
with open(url, 'r') as fid:
opens the file searchindex.js as:
<_io.TextIOWrapper name='searchindex.js' mode='r' encoding='ANSI_X3.4-1968'>
With this encoding the ΓΌ umlaut raise the mentioned UnicodeDecodeError.
If I force sphinxgallery/docs_resolv.py:48 to open it with UTF-8 encoding
with open(url, 'r', encoding='utf-8') as fid:
fid is <_io.TextIOWrapper name='searchindex.js' mode='r' encoding='utf-8'>
and the error disapears.
I cannot estimate if this utf8 default encoding leads to further problems or not. But if its safe, it would be nice you can add this setting.
Cheers
from sphinx-gallery.
Could it not be a problem with your locale?
What's the output of locale
in your shell?
Also what do you get when doing python -c 'import sys; print(sys.stdout.encoding)'
?
from sphinx-gallery.
Locale: LANG=C
python -c 'import sys; print(sys.stdout.encoding)' says ANSI_X3.4-1968
Hmm .. interesting point.
I have to dig out where these encoding setting come from.
Probably, an utf8 encoding will solve this issue.
Thank you.
from sphinx-gallery.
@carsten-forty2 did you manage to fix your problem eventually ?
from sphinx-gallery.
@lesteve no .. I had not yet the time to dig in why my sys.stdout.encoding is no UTF8
I live with a local patched version of sphinxgallery/docs_resolv.py
from sphinx-gallery.
my LC_CTYPE was set to 'C' .. that causes python to take these ANSI encoding.
If I set my LC_CTYPE to 'de_DE.UTF-8' .. everything runs fine without the mentioned patch.
The issue can be closed for me.
from sphinx-gallery.
I live with a local patched version of sphinxgallery/docs_resolv.py
OK can you just paste your patch in case this is useful for later or for someone else?
from sphinx-gallery.
sphinxgallery/docs_resolv.py:48
-with open(url, 'r') as fid:
+with open(url, 'r', encoding='utf-8') as fid:
from sphinx-gallery.
Related Issues (20)
- Most recent version shows table of content HOT 1
- Gallery thumbnails now showing up HOT 2
- Debug Example Gallery Sorting HOT 4
- Sphinx roles and directives not working in generated examples HOT 4
- BUG: API usage fails when plotting disabled HOT 2
- Links in RST epilog show a warning HOT 2
- Question: how to remove Notebook download? HOT 2
- [Question] image caption?
- Rename README.rst to gallery_header.rst HOT 2
- How to use the only syntax based on sphinx gallery to output different documents according to labels HOT 4
- Order dependence with Jupyterlite HOT 6
- How does the only syntax take effect on titles HOT 3
- "Broken" gallery examples should still link to the code HOT 2
- Add option to set thumbnails for expected failing examples HOT 2
- Define CSS variables when `html[data-theme]` does not exist HOT 6
- Doc: document testing HOT 4
- [Maint] Add HTML parsing library as a testing dependency HOT 2
- Online documentation not deployed HOT 1
- Thumbnail generation is not working for plotly plots HOT 1
- ENH: remove file calling mini-gallery from mini-gallery
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sphinx-gallery.