blogofile 0.8b1 fails when files contain UTF-8 #135
Comments
Thanks for the concise report, Michael. I think that this is related to #134 and this thread on the mail-list: https://groups.google.com/d/topic/blogofile-discuss/Bh9UDWuf-YM/discussion I hope to get this resolved this week. |
It definitely seems like solving #134 would fix this issue, too. I’d be happy to test and I hope that you will release a new version of blogofile so that it will be pip-installable soonish :). Thanks! |
This is a big enough issue that I will probably do a 0.8b2 release as soon as it is resolved. Especially since you are testing migration of a 0.7 site to 0.8 and I'm really, really interested in hearing how that goes! |
Well, the photo_gallery controller I have been using (from https://github.com/kstrauser/blogofileplugins/) breaks entirely. I managed to fix the most pressing issues, but still can’t figure out how to add descriptions to image directories without getting an exception. Anyway, that’s a separate issue. If you’re interested in how to reproduce that issue, tell me how to best reach you via email :). Apart from the photo_gallery, I could not notice any problems. |
Hmm. I can't seem to reproduce this problem: (blogofile-dev-2.7)tom:tmp$ export LANG=de_DE.UTF-8
(blogofile-dev-2.7)tom:tmp$ env | grep LANG
LANG=de_DE.UTF-8
(blogofile-dev-2.7)tom:tmp$ blogofile init broken
_config.py for a bare (do-it-yourself) site written to broken
If you were expecting more, please see `blogofile init -h`
(blogofile-dev-2.7)tom:tmp$ cd broken/
(blogofile-dev-2.7)tom:broken$ blogofile build
(blogofile-dev-2.7)tom:broken$ mkdir _templates
(blogofile-dev-2.7)tom:broken$ echo foo > _templates/index.html.mako
(blogofile-dev-2.7)tom:broken$ blogofile build
(blogofile-dev-2.7)tom:broken$ echo 'maßband' > _templates/index.html.mako
(blogofile-dev-2.7)tom:broken$ blogofile build
(blogofile-dev-2.7)tom:broken$ blogofile --version
Blogofile 0.8b1 -- http://www.blogofile.com -- CPython 2.7.3
(blogofile-dev-2.7)tom:broken$ file _templates/index.html.mako
_templates/index.html.mako: UTF-8 Unicode text
(blogofile-dev-2.7)tom:broken$ uname -a
Darwin tom.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64 Tried it under Python 3.2 as well, and got the same results. I'm not questioning that the issue is real. I just need to find a way of reproducing it so that I can explore it and confirm that the resolution is correct. |
You ran:
but I ran:
To be sure, I just installed Debian squeeze in a VM and ran the following commands:
|
You're right, I did run echo 'maßband' > index.html.mako and when I did I'm sure I got a different error traceback about a missing template that made me think the above was a typo, missing the Just tried again, and successfully reproduced your traceback. Sorry for the confusion. Now to figure why blogofile is opening the template file at all instead of leaving that to Mako as Mike says in #134. |
Thanks for helping to define and resolve this issue, Michael. Note that the test case above now fails due to the lack of a |
I just upgraded to blogofile 0.8b1 using
pip install --upgrade blogofile
.This broke my site which formerly worked in blogofile 0.7.x (not sure about x anymore). Here is how to reproduce my problem:
As you can see, my locale setup is correct (and no other program is having utf-8/unicode trouble), and the file contains proper utf-8: http://www.fileformat.info/info/unicode/char/df/index.htm confirms that 0xc3 0x9f is UTF-8 for U+00DF.
I tried replacing
open(self.template_name)
in template.py:112 withcodecs.open(self.template_name, encoding='utf-8')
, which seems to fix the problem. I’m not very experienced when it comes to unicode handling in python, though, so I did not submit a pull request and would rather like you to reproduce the issue and then see if the proposed fix is appropriate. Probably the fix also needs to be applied in other places in the code.The text was updated successfully, but these errors were encountered: