equal
deleted
inserted
replaced
155 >>> f(b'hello:world?') |
155 >>> f(b'hello:world?') |
156 'hello~3aworld~3f' |
156 'hello~3aworld~3f' |
157 >>> f(b'the\\x07quick\\xADshot') |
157 >>> f(b'the\\x07quick\\xADshot') |
158 'the~07quick~adshot' |
158 'the~07quick~adshot' |
159 ''' |
159 ''' |
160 cmap = dict([(chr(x), chr(x)) for x in xrange(127)]) |
160 xchr = pycompat.bytechr |
|
161 cmap = dict([(xchr(x), xchr(x)) for x in xrange(127)]) |
161 for x in _reserved(): |
162 for x in _reserved(): |
162 cmap[chr(x)] = "~%02x" % x |
163 cmap[xchr(x)] = "~%02x" % x |
163 for x in range(ord("A"), ord("Z") + 1): |
164 for x in range(ord("A"), ord("Z") + 1): |
164 cmap[chr(x)] = chr(x).lower() |
165 cmap[xchr(x)] = xchr(x).lower() |
165 def lowerencode(s): |
166 def lowerencode(s): |
166 return "".join([cmap[c] for c in s]) |
167 return "".join([cmap[c] for c in s]) |
167 return lowerencode |
168 return lowerencode |
168 |
169 |
169 lowerencode = getattr(parsers, 'lowerencode', None) or _buildlowerencodefun() |
170 lowerencode = getattr(parsers, 'lowerencode', None) or _buildlowerencodefun() |