changeset 16066:6a42846cf769 stable

i18n: use util.pconvert() instead of 'str.replace()' for problematic encoding some problematic encodings use backslash as part of multi-byte characters. util.pconvert() can treat strings in such encodings correctly, if win32mbcs is enabled, but str.replace() can not.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 05 Feb 2012 22:58:31 +0900
parents 7e5a281a082c
children 467a85ced564
files hgext/largefiles/lfutil.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/largefiles/lfutil.py	Fri Feb 03 19:47:09 2012 +0100
+++ b/hgext/largefiles/lfutil.py	Sun Feb 05 22:58:31 2012 +0900
@@ -303,7 +303,7 @@
     # 2) Join with '/' because that's what dirstate always uses, even on
     #    Windows. Change existing separator to '/' first in case we are
     #    passed filenames from an external source (like the command line).
-    return shortname + '/' + filename.replace(os.sep, '/')
+    return shortname + '/' + util.pconvert(filename)
 
 def isstandin(filename):
     '''Return true if filename is a big file standin. filename must be
@@ -314,7 +314,7 @@
     # Split on / because that's what dirstate always uses, even on Windows.
     # Change local separator to / first just in case we are passed filenames
     # from an external source (like the command line).
-    bits = filename.replace(os.sep, '/').split('/', 1)
+    bits = util.pconvert(filename).split('/', 1)
     if len(bits) == 2 and bits[0] == shortname:
         return bits[1]
     else:
@@ -433,7 +433,7 @@
 
 def unixpath(path):
     '''Return a version of path normalized for use with the lfdirstate.'''
-    return os.path.normpath(path).replace(os.sep, '/')
+    return util.pconvert(os.path.normpath(path))
 
 def islfilesrepo(repo):
     return ('largefiles' in repo.requirements and