![]() The Markdown module authors probably use unicode() (where the exception is thrown) as a quality gate to the rest of the code - it will convert ASCII or re-wrap existing Unicodes strings to a new Unicode string. Files and text data are always transferred in encoded strings. Strings are decoded to Unicode and Unicodes are encoded to strings. Strings contain encoded text, beit UTF-8, UTF-16, ISO-8895-1, GBK, Big5 etc. They only hold Unicode point codes and therefore can hold any Unicode point from across the entire spectrum. In brief, Unicode strings are an entirely separate type of Python string that does not contain any encoding. UnicodeDecodeError: 'ascii' codec can't decode byte generally happens when you try to convert a Python 2.x str that contains non-ASCII to a Unicode string without specifying the encoding of the original string. Without seeing the source it's difficult to know the root cause, so I'll have to speak generally. Unicode Zen in Python 2.x - The Long Version ![]() Don't be tempted to use quick reload hacks.Fix your locale: How to solve UnicodeDecodeError in Python 3.6?.Try to convert strings to Unicode strings as soon as possible in your code.Don't assume your strings are UTF-8 encoded.In my site, Chinese post can be published successfully. In some other python-based static blog apps, Chinese post can be published successfully. Note: Markdown only accepts unicode input! UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 1: ordinal not in range(128). ta = (page.original)įile "/usr/local/lib/python2.7/site-packages/wok/renderers.py", line 46, in renderįile "/usr/local/lib/python2.7/site-packages/markdown/init.py", line 419, in markdownįile "/usr/local/lib/python2.7/site-packages/markdown/init.py", line 281, in convert P = om_file(os.path.join(root, f), self.options, self, renderer)įile "/usr/local/lib/python2.7/site-packages/wok/page.py", line 111, in from_file As3:~/ngokevin-site# nano content/blog/20140114_test-chinese.mkdįile "/usr/local/lib/python2.7/site-packages/wok/engine.py", line 104, in initįile "/usr/local/lib/python2.7/site-packages/wok/engine.py", line 238, in load_pages
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |