Show More
@@ -95,11 +95,15 b' def tolocal(s):' | |||||
95 | for e in ('UTF-8', fallbackencoding): |
|
95 | for e in ('UTF-8', fallbackencoding): | |
96 | try: |
|
96 | try: | |
97 | u = s.decode(e) # attempt strict decoding |
|
97 | u = s.decode(e) # attempt strict decoding | |
98 | if e == 'UTF-8': |
|
98 | r = u.encode(encoding, "replace") | |
99 | return localstr(s, 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 | else: |
|
104 | else: | |
101 | return localstr(u.encode('UTF-8'), |
|
105 | return localstr(u.encode('UTF-8'), r) | |
102 | u.encode(encoding, "replace")) |
|
106 | ||
103 | except LookupError, k: |
|
107 | except LookupError, k: | |
104 | raise error.Abort("%s, please check your locale settings" % k) |
|
108 | raise error.Abort("%s, please check your locale settings" % k) | |
105 | except UnicodeDecodeError: |
|
109 | except UnicodeDecodeError: |
@@ -241,3 +241,9 b' hg log (dolphin)' | |||||
241 | [255] |
|
241 | [255] | |
242 | $ cp latin-1-tag .hg/branch |
|
242 | $ cp latin-1-tag .hg/branch | |
243 | $ HGENCODING=latin-1 hg ci -m 'auto-promote legacy name' |
|
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