##// END OF EJS Templates
encoding: use getattr isntead of hasattr
Augie Fackler -
r14951:61807854 default
parent child Browse files
Show More
@@ -140,12 +140,12 b' ambiguous = os.environ.get("HGENCODINGAM'
140 140 def colwidth(s):
141 141 "Find the column width of a UTF-8 string for display"
142 142 d = s.decode(encoding, 'replace')
143 if hasattr(unicodedata, 'east_asian_width'):
143 eaw = getattr(unicodedata, 'east_asian_width', None)
144 if eaw is not None:
144 145 wide = "WF"
145 146 if ambiguous == "wide":
146 147 wide = "WFA"
147 w = unicodedata.east_asian_width
148 return sum([w(c) in wide and 2 or 1 for c in d])
148 return sum([eaw(c) in wide and 2 or 1 for c in d])
149 149 return len(d)
150 150
151 151 def lower(s):
General Comments 0
You need to be logged in to leave comments. Login now