utf-8 read/write file

Kent Johnson kent3737 at gmail.com
Wed Oct 8 18:58:19 EDT 2008


On Oct 8, 5:55 pm, gigs <g... at hi.t-com.hr> wrote:
> Benjamin wrote:
> > On Oct 8, 12:49 pm, Bruno <Br... at hi.t-com.hr> wrote:
> >> Hi!
>
> >> I have big .txt file which i want to read, process and write to another .txt file.
> >> I have done script for that, but im having problem with croatian characters
> >> (©,Ð,®,È,Æ).
>
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x9e in position 0:
> unexpected code byte

Are you sure you have UTF-8 data? I guess your file is encoded in
CP1250 or CP1252; in both of these charsets 0x9e represents LATIN
SMALL LETTER Z WITH CARON.

Kent



More information about the Python-list mailing list