Unicode File I/O Grief

Chris Liechti cliechti at gmx.net
Thu May 16 17:13:21 EDT 2002


Dale Strickland-Clark <dale at riverhall.NOTHANKS.co.uk> wrote in 
news:qv68eug3vnm7r0plf76aatqsl4lja6io0r at 4ax.com:

> martin at v.loewis.de (Martin v. Loewis) wrote:
> 
>>I recommend to do
>>
>>codecs.open('C:\\odd.txt', 'wb', encoding="utf-8").write(ucString)
>>
>>or
>>
>>file('C:\\odd.txt', 'wb').write(ucString.encode("utf-8"))
>>
> 
> But surely these translate the string before writing it?
> 
> I don't want it translated I want to see EXACTLY what's in there as it
> stands.

well whatever that means ;-) where does it stand?

maybe you want the "utf-16" encoding where you have two bytes per 
character? (i think thats also the encoding used for internal 
represenation)

chris

> --
> Dale Strickland-Clark
> Riverhall Systems Ltd



-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list