abakan-zz / ablog

ABlog for blogging with Sphinx
ablog.readthedocs.org
Other
122 stars 35 forks source link

"ablog build" fails in a fresh repository, encoding issues with conf.py #86

Open tiwo opened 7 years ago

tiwo commented 7 years ago

On Windows, ablog build somwhere assumes conf.py's encoding as "cp1252", triggering UnicodeDecodeError when using non-ASCII character in the blog title (äöüß).

tiwo commented 7 years ago

While writing up how to reproduce this issue, I realize this happens even when I only use ASCII characters; fancy Unicode quotes in ablog's conf.py template are the culprits (“title”) .

I'm quite sure that the fancy quotes should be replaced by ASCII quotes, and I'll send a (trivial) partial fix later today or tomorrow. I'll still have to see if accents and umlauts in e.g. the blog title work.


Here's how to reproduce this issue: I use Windows, MINGW64 bash, Python 3.5.2. In an empty directory:

$ virtualenv ENV
[...]
$ source ENV/Scripts/activate
(ENV) $ pip install ablog
[...]
(ENV) $ pip show ablog
Name: ablog
Version: 0.8.4
[...]

Now, $ ablog start fails for me because of issue #78, "cannot import name make_admonition"; I apply https://github.com/lsaffre/ablog/commit/046e5dbbf3ea7a33f3a07dd6455bdcd1cc5f0375 to ENV/Lib/site-packages/ablog/post.py to get that out of the way. Then:

(ENV) $ ablog start
Welcome to the ABlog 0.8.4 quick start utility.

I press Enter, ANYTITLE Enter, ANYNAME Enter, Enter.

[...]
Creating file .\conf.py.
Creating file .\index.rst.
Creating file .\about.rst.
Creating file .\first-post.rst.
Finished: An initial directory structure has been created.

(ENV) $ ablog build
Traceback (most recent call last):
  File "c:\program files\python35\Lib\runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\program files\python35\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\blgus\AppData\Local\Temp\bug\ENV\Scripts\ablog.exe\__main__.py", line 9, in <module>
  File "c:\users\blgus\appdata\local\temp\bug\env\lib\site-packages\ablog\commands.py", line 404, in ablog_main
    namespace.func(**namespace.__dict__)
  File "c:\users\blgus\appdata\local\temp\bug\env\lib\site-packages\ablog\commands.py", line 119, in ablog_build
    confdir = find_confdir()
  File "c:\users\blgus\appdata\local\temp\bug\env\lib\site-packages\ablog\commands.py", line 22, in find_confdir
    if isfile(conf) and 'ablog' in open(conf).read():
  File "c:\users\blgus\appdata\local\temp\bug\env\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 585: character maps to <undefined>
benjaminweb commented 7 years ago

Confirmed for me. I currently only resist to adopt ablog for stability concerns.

nabobalis commented 6 years ago

A new version of Ablog (v0.9.0) is out at this repo.

This issue should be fixed now but we made it explicitly support Sphinx>=1.6.