Closed trustin closed 3 years ago
Patch:
diff -urN dist.orig/sphinxemoji/sphinxemoji.py dist/sphinxemoji/sphinxemoji.py
--- dist.orig/sphinxemoji/sphinxemoji.py 2019-07-11 09:13:36.000000000 +0900
+++ dist/sphinxemoji/sphinxemoji.py 2019-07-26 23:40:15.282033254 +0900
@@ -23,7 +23,7 @@
config = self.document.settings.env.config
settings, source = self.document.settings, self.document['source']
codes = resource_filename(__name__, 'codes.json')
- replacements = json.load(open(codes))
+ replacements = json.load(open(codes, encoding='utf-8-sig'))
to_handle = (set(replacements.keys()) -
set(self.document.substitution_defs))
Thanks for reporting this issue. Does it work fine for you if you set encoding='utf'
?
I will try to add AppVeyor to CI to check Windows compatibility.
Yes, it works fine with encoding='utf-8-sig'.
I meant with encoding='utf'
, without the -8-sig
(I have not tried). :innocent:
I didn't try it either yet, but is it a valid encoding at all? (I'm not a Python expert so.. :sweat_smile:)
BTW, GitHub Actions offer free CI for Linux, Windows, and macOS. Perhaps the project could use it to test for problems like this. If someone sets up a test, I'm willing to contribute the Actions config file for running it automatically on every push.
@honzajavorek It would be great to add some CI checks.
There are currently no tests in this project, but we could add some checks for the documentation. I opened an issue, feel free to contribute the required config file. :blush:
In a system whose system encoding is not UTF-8, sphinxemoji will fail with
UnicodeDecodeError
:The problem could be fixed by passing the
encoding='utf-8-sig'
parameter to theopen(codes)
call.