Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix character encoding problems #194

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions landslide/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-

import sys
import chardet

from optparse import OptionParser

Expand Down Expand Up @@ -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)
Expand Down