Python UTF-8 and codecs

Mike Currie dev at null.com
Tue Jun 27 19:13:08 EDT 2006


Well,  not really.  It doesn't affect the result.  I still get the error 
message.  Did you get a different result?


"Serge Orlov" <serge.orlov at gmail.com> wrote in message 
news:mailman.7522.1151446300.27775.python-list at python.org...
> On 6/27/06, Mike Currie <dev at null.com> wrote:
>> Okay,
>>
>> Here is a sample of what I'm doing:
>>
>>
>> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
>> win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> >>> filterMap = {}
>> >>> for i in range(0,255):
>> ...     filterMap[chr(i)] = chr(i)
>> ...
>> >>> filterMap[chr(9)] = chr(136)
>> >>> filterMap[chr(10)] = chr(133)
>> >>> filterMap[chr(136)] = chr(9)
>> >>> filterMap[chr(133)] = chr(10)
>
> This part is incorrect, it should be:
>
> filterMap = {}
> for i in range(0,128):
>    filterMap[chr(i)] = chr(i)
>
> filterMap[chr(9)] = unichr(136)
> filterMap[chr(10)] = unichr(133)
> filterMap[unichr(136)] = chr(9)
> filterMap[unichr(133)] = chr(10) 





More information about the Python-list mailing list