equal
deleted
inserted
replaced
268 asciilower = getattr(parsers, 'asciilower', asciilower) |
268 asciilower = getattr(parsers, 'asciilower', asciilower) |
269 |
269 |
270 def lower(s): |
270 def lower(s): |
271 "best-effort encoding-aware case-folding of local string s" |
271 "best-effort encoding-aware case-folding of local string s" |
272 try: |
272 try: |
273 s.decode('ascii') # throw exception for non-ASCII character |
273 return asciilower(s) |
274 return s.lower() |
|
275 except UnicodeDecodeError: |
274 except UnicodeDecodeError: |
276 pass |
275 pass |
277 try: |
276 try: |
278 if isinstance(s, localstr): |
277 if isinstance(s, localstr): |
279 u = s._utf8.decode("utf-8") |
278 u = s._utf8.decode("utf-8") |