Show More
@@ -95,11 +95,15 b' def tolocal(s):' | |||
|
95 | 95 | for e in ('UTF-8', fallbackencoding): |
|
96 | 96 | try: |
|
97 | 97 | u = s.decode(e) # attempt strict decoding |
|
98 | if e == 'UTF-8': | |
|
99 | return localstr(s, u.encode(encoding, "replace")) | |
|
98 | r = u.encode(encoding, "replace") | |
|
99 | if u == r.decode(encoding): | |
|
100 | # r is a safe, non-lossy encoding of s | |
|
101 | return r | |
|
102 | elif e == 'UTF-8': | |
|
103 | return localstr(s, r) | |
|
100 | 104 | else: |
|
101 | return localstr(u.encode('UTF-8'), | |
|
102 | u.encode(encoding, "replace")) | |
|
105 | return localstr(u.encode('UTF-8'), r) | |
|
106 | ||
|
103 | 107 | except LookupError, k: |
|
104 | 108 | raise error.Abort("%s, please check your locale settings" % k) |
|
105 | 109 | except UnicodeDecodeError: |
@@ -241,3 +241,9 b' hg log (dolphin)' | |||
|
241 | 241 | [255] |
|
242 | 242 | $ cp latin-1-tag .hg/branch |
|
243 | 243 | $ HGENCODING=latin-1 hg ci -m 'auto-promote legacy name' |
|
244 | ||
|
245 | Test roundtrip encoding of lookup tables when not using UTF-8 (issue2763) | |
|
246 | ||
|
247 | $ HGENCODING=latin-1 hg up `cat latin-1-tag` | |
|
248 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |
|
249 |
General Comments 0
You need to be logged in to leave comments.
Login now