Python UTF-8 and codecs

2006-06-27 Thread Mike Currie
I'm trying to write out files that have utf-8 characters 0x85 and 0x08 in them. Every configuration I try I get a UnicodeError: ascii codec can't decode byte 0x85 in position 255: oridinal not in range(128) I've tried using the codecs.open('foo.txt', 'rU', 'utf-8', errors='strict') and that do

Re: Python UTF-8 and codecs

2006-06-27 Thread Mike Currie
files. Finally right before importing them into a database convert them back to new line and tab's thus preserving the field values. Will python not handle the control characters correctly? "Serge Orlov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On

Re: Python UTF-8 and codecs

2006-06-27 Thread Mike Currie
write(filteredLine) Traceback (most recent call last): File "", line 1, in ? File "C:\Python24\lib\codecs.py", line 501, in write return self.writer.write(data) File "C:\Python24\lib\codecs.py", line 178, in write data, consumed = self.encode(object, self.errors)

Ascii Encoding Error with UTF-8 encoder

2006-06-27 Thread Mike Currie
Can anyone explain why I'm getting an ascii encoding error when I'm trying to write out using a UTF-8 encoder? Thanks 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

Re: Python UTF-8 and codecs

2006-06-27 Thread Mike Currie
Well, not really. It doesn't affect the result. I still get the error message. Did you get a different result? "Serge Orlov" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 6/27/06, Mike Currie <[EMAIL PROTECTED]> wrote: >> Okay, >

Re: Ascii Encoding Error with UTF-8 encoder

2006-06-27 Thread Mike Currie
27;ve been left with the implementation however. "John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 28/06/2006 7:46 AM, Mike Currie wrote: >> Can anyone explain why I'm getting an ascii encoding error when I'm >> trying to