Fix the encoding variable that we're using in the new function
This commit is contained in:
parent
1e1d827240
commit
6a55d124c6
@ -2,7 +2,15 @@ Index: docutils-0.8.1/docutils/frontend.py
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- docutils-0.8.1.orig/docutils/frontend.py
|
--- docutils-0.8.1.orig/docutils/frontend.py
|
||||||
+++ docutils-0.8.1/docutils/frontend.py
|
+++ docutils-0.8.1/docutils/frontend.py
|
||||||
@@ -193,7 +193,31 @@ def make_paths_absolute(pathdict, keys,
|
@@ -33,6 +33,7 @@ import sys
|
||||||
|
import warnings
|
||||||
|
import ConfigParser as CP
|
||||||
|
import codecs
|
||||||
|
+import locale
|
||||||
|
import optparse
|
||||||
|
from optparse import SUPPRESS_HELP
|
||||||
|
import docutils
|
||||||
|
@@ -193,7 +194,36 @@ def make_paths_absolute(pathdict, keys,
|
||||||
value = make_one_path_absolute(base_path, value)
|
value = make_one_path_absolute(base_path, value)
|
||||||
pathdict[key] = value
|
pathdict[key] = value
|
||||||
|
|
||||||
@ -23,7 +31,12 @@ Index: docutils-0.8.1/docutils/frontend.py
|
|||||||
+ # converting to Unicode (Python 3 does this automatically):
|
+ # converting to Unicode (Python 3 does this automatically):
|
||||||
+ if sys.version_info < (3,0):
|
+ if sys.version_info < (3,0):
|
||||||
+ # TODO: make this failsafe and reversible
|
+ # TODO: make this failsafe and reversible
|
||||||
+ path = unicode(path, locale_encoding)
|
+ # locale.getpreferredencoding is not to be preferred to getlocale or
|
||||||
|
+ # getdefaultlocale but it is preferred to hardcoding a value. We end
|
||||||
|
+ # with latin-1 because it's one of the encodings that is valid for
|
||||||
|
+ # every byte.
|
||||||
|
+ encoding = locale_encoding or locale.getpreferredencoding() or 'latin-1'
|
||||||
|
+ path = unicode(path, encoding)
|
||||||
+ return path
|
+ return path
|
||||||
+
|
+
|
||||||
def make_one_path_absolute(base_path, path):
|
def make_one_path_absolute(base_path, path):
|
||||||
|
Loading…
Reference in New Issue
Block a user