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

Support for none-ascii wiki md filename #9

Open
yegle opened this issue Dec 7, 2011 · 2 comments
Open

Support for none-ascii wiki md filename #9

yegle opened this issue Dec 7, 2011 · 2 comments

Comments

@yegle
Copy link

yegle commented Dec 7, 2011

When I name my file as 测试.md in wiki and run markdoc build, there will be an exception:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe8 in position 3: ordinal not in range(128)

Full exception can be find here http://pastie.org/2979381

@yegle
Copy link
Author

yegle commented Dec 7, 2011

OK, the title should be change to: use unicode instead of str in the whole project.

I tried to fix this issue but found that I need to convert so many str to unicode using str.unicode().

@yegle
Copy link
Author

yegle commented Dec 9, 2011

The right fix, super simple right? :-)

diff --git a/src/markdoc/config.py b/src/markdoc/config.py
index 1a64633..722ac4f 100644
--- a/src/markdoc/config.py
+++ b/src/markdoc/config.py
@@ -64,8 +64,8 @@ class Config(dict):
     def __init__(self, config_file, config):
         super(Config, self).__init__(flatten(config))

-        self['meta.config-file'] = config_file
-        self['meta.root'] = p.dirname(config_file)
+        self['meta.config-file'] = config_file.decode('utf-8')
+        self['meta.root'] = p.dirname(config_file).decode('utf-8')

     def __getitem__(self, key):
         try:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant