Character encodings and codecs

vincent wehren v.wehren at home.nl
Sat Feb 1 08:43:17 CET 2003


"Grumfish" <nobody at nowhere.com> schrieb im Newsbeitrag
news:agcm3v8ep1thj579baihnokcr3o6b7c6eb at 4ax.com...
> I'm trying to read and write files with differend character encodings.
> I would like to convert a file from one encoding to another. I assume
> I should use the codec module but I'm not sure how.

Try "unicode()" to convert your byte-oriented input into unicode. Then use
"encode()" on your unicode strings into
your target encoding.

How can I read in
> a part at a time of a multibyte encoded file without destroying the
> text?

    Do you mean: reading chunks without accidentally breaking up characters?
>
> Could some one please post a short example of converting a file from
> one multibyte encoding to another without reading the whole file into
> memory?
>
> Any online tutorials would also be very helpful.






More information about the Python-list mailing list