From 6a55d124c697781bd57c34fa7c38f4756bcb0fae Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Mon, 30 Jan 2012 20:33:12 -0800 Subject: [PATCH] Fix the encoding variable that we're using in the new function --- docutils-unicode-traceback.patch | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docutils-unicode-traceback.patch b/docutils-unicode-traceback.patch index 4553ea2..41ac072 100644 --- a/docutils-unicode-traceback.patch +++ b/docutils-unicode-traceback.patch @@ -2,7 +2,15 @@ Index: docutils-0.8.1/docutils/frontend.py =================================================================== --- docutils-0.8.1.orig/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) pathdict[key] = value @@ -23,7 +31,12 @@ Index: docutils-0.8.1/docutils/frontend.py + # converting to Unicode (Python 3 does this automatically): + if sys.version_info < (3,0): + # 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 + def make_one_path_absolute(base_path, path):