Re: how to write a unicode string to a file ?

2009-10-19 Thread Walter Dörwald
On 17.10.09 08:28, Mark Tolonen wrote: Kee Nethery k...@kagi.com wrote in message news:aaab63c6-6e44-4c07-b119-972d4f49e...@kagi.com... On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.com wrote: snip The thing is,

Re: how to write a unicode string to a file ?

2009-10-17 Thread Mark Tolonen
Kee Nethery k...@kagi.com wrote in message news:aaab63c6-6e44-4c07-b119-972d4f49e...@kagi.com... On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.com wrote: snip The thing is, I'd be VERY surprised (neigh, shocked!) if

Re: how to write a unicode string to a file ?

2009-10-17 Thread Stef Mientki
Stephen Hansen wrote: snip although this is a very good explanation, and showing character encoding isn't that easy ;-) thanks very much ! Wasn't aware of the SQLite pragma. also thanks to the others who replied. cheers, Stef -- http://mail.python.org/mailman/listinfo/python-list

Re: how to write a unicode string to a file ?

2009-10-17 Thread Mark Tolonen
Mark Tolonen metolone+gm...@gmail.com wrote in message news:hbbo6d$6u...@ger.gmane.org... Kee Nethery k...@kagi.com wrote in message news:aaab63c6-6e44-4c07-b119-972d4f49e...@kagi.com... On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki

Re: how to write a unicode string to a file ?

2009-10-16 Thread Niklas Norrthon
On 16 Okt, 06:10, Donn donn.in...@gmail.com wrote: On Friday 16 October 2009 01:59:43 Stephen Hansen wrote: Just to say, thanks for that post. I am an old ascii dog and this notion of encoding and decoding is taking such a lng time to penetrate my thick skull. Little snippets like your

Re: how to write a unicode string to a file ?

2009-10-16 Thread Paul Boddie
On 16 Okt, 01:49, Benjamin Kaplan benjamin.kap...@case.edu wrote: Unicode is an abstract concept, and as such can't actually be written to a file. To write Unicode to a file, you have to specify an encoding so Python has actual bytes to write. If Python doesn't know what encoding it should

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stephen Fairchild
Stef Mientki wrote: hello, By writing the following unicode string (I hope it can be send on this mailing list) Bücken to a file fh.write ( line ) I get the following error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 9: ordinal not

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stef Mientki
Stephen Hansen wrote: On Thu, Oct 15, 2009 at 4:43 PM, Stef Mientki stef.mien...@gmail.com mailto:stef.mien...@gmail.com wrote: hello, By writing the following unicode string (I hope it can be send on this mailing list) Bücken to a file fh.write ( line ) I

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stephen Hansen
On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.comwrote: Unfortunately, there is no simple answer to these questions. Thanks guys, I didn't know the codecs module, and the codecs seems to be a good solution, at least it can safely write a file. But now I have to open that

Re: how to write a unicode string to a file ?

2009-10-16 Thread Kee Nethery
On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.com wrote: snip The thing is, I'd be VERY surprised (neigh, shocked!) if Excel can't open a file that is in UTF8-- it just might need to be TOLD that its utf8 when you go

Re: how to write a unicode string to a file ?

2009-10-16 Thread Stephen Hansen
On Fri, Oct 16, 2009 at 6:02 PM, Kee Nethery k...@kagi.com wrote: On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki stef.mien...@gmail.com wrote: snip The thing is, I'd be VERY surprised (neigh, shocked!) if Excel can't open a file that is

how to write a unicode string to a file ?

2009-10-15 Thread Stef Mientki
hello, By writing the following unicode string (I hope it can be send on this mailing list) Bücken to a file fh.write ( line ) I get the following error: UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 9: ordinal not in range(128) How should I write

Re: how to write a unicode string to a file ?

2009-10-15 Thread Benjamin Kaplan
On Thu, Oct 15, 2009 at 7:43 PM, Stef Mientki stef.mien...@gmail.com wrote: hello, By writing the following unicode string (I hope it can be send on this mailing list)   Bücken to a file    fh.write ( line ) I get the following error:  UnicodeEncodeError: 'ascii' codec can't encode

Re: how to write a unicode string to a file ?

2009-10-15 Thread Stephen Hansen
On Thu, Oct 15, 2009 at 4:43 PM, Stef Mientki stef.mien...@gmail.comwrote: hello, By writing the following unicode string (I hope it can be send on this mailing list) Bücken to a file fh.write ( line ) I get the following error: UnicodeEncodeError: 'ascii' codec can't encode

Re: how to write a unicode string to a file ?

2009-10-15 Thread Donn
On Friday 16 October 2009 01:59:43 Stephen Hansen wrote: Just to say, thanks for that post. I am an old ascii dog and this notion of encoding and decoding is taking such a lng time to penetrate my thick skull. Little snippets like your post are valuable insights. I have made a gnote of it!