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" 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 >>> wrote: >> >> snip >> >>> The thing is, I'd be VERY

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

2009-10-17 Thread Mark Tolonen
"Mark Tolonen" wrote in message news:hbbo6d$6u...@ger.gmane.org... "Kee Nethery" 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 wrote: snip The thing is, I'd be

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

2009-10-17 Thread Stef Mientki
Stephen Hansen wrote: 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-16 Thread Mark Tolonen
"Kee Nethery" 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 wrote: snip The thing is, I'd be VERY surprised (neigh, shocked!) if Excel can't open a file that is in

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 wrote: > > On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote: > >> On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki >> 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 m

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 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 and open the file, as

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 wrote: 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 file in Excel 200

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 > 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 err

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

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

2009-10-16 Thread Donn
On Friday 16 October 2009 13:08:38 Niklas Norrthon wrote: > that made me think I understand > Lol, I know the feeling! :D I have read that page a few times, and I always emerge thinking 'now I've got it'. Then a week passes... \d -- http://mail.python.org/mailman/listinfo/python-list

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

2009-10-16 Thread Paul Boddie
On 16 Okt, 01:49, Benjamin Kaplan 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 use, it defaults to pl

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

2009-10-16 Thread Niklas Norrthon
On 16 Okt, 06:10, Donn 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 post are valuable

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!

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 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

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 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

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