From e40b0248a41e53b6ea337e13107cbb423e0541cb Mon Sep 17 00:00:00 2001 From: corfox Date: Mon, 14 Nov 2016 16:43:42 +0800 Subject: [PATCH 1/2] Solving character encoding problems [Issue 188](https://github.com/adamzap/landslide/issues/188) Error: 'ascii' codec can't decode byte 0xe7 in position 0: ordinal not in range(128) --- landslide/main.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/landslide/main.py b/landslide/main.py index 6c923eda..04bdfe70 100755 --- a/landslide/main.py +++ b/landslide/main.py @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- import sys +import chardet from optparse import OptionParser @@ -163,7 +164,12 @@ def run(input_file, options): def main(): """Main program entry point""" + if sys.getdefaultencoding() != 'utf-8': + reload(sys) + sys.setdefaultencoding('utf-8') + options, input_file = _parse_options() + input_file = input_file.decode(chardet.detect(input_file).get('encoding')) if (options.debug): run(input_file, options) From c111e9fdb5eff81d3ae5da50cb2e667bed221047 Mon Sep 17 00:00:00 2001 From: corfox Date: Mon, 14 Nov 2016 16:52:49 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 63ce18c5..03be3528 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ The following markdown produces [this slideshow][sample]. `python` and the following modules: - `jinja2` +- `chardet` - `pygments` for code blocks syntax coloration #### Markup Conversion