how to write a unicode string to a file ?

Stephen Hansen apt.shansen at
Sat Oct 17 03:11:20 CEST 2009

On Fri, Oct 16, 2009 at 6:02 PM, Kee Nethery <kee at> wrote:
>  On Oct 16, 2009, at 5:49 PM, Stephen Hansen wrote:
>> On Fri, Oct 16, 2009 at 5:07 PM, Stef Mientki <stef.mientki at>
>> 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 UTF8 looks just like ASCII -- until it contains
>> characters that can't be expressed in ASCII. But I don't know what type of
>> file it is you're saving.
> We found that UTF-16 was required for Excel. It would not "do the right
> thing" when presented with UTF-8.
Oh, on reflection that doesn't surprise me. Lots of windows/microsoft stuff
is UTF16.

So, Stef-- for excel, I'd just write out as utf16. And use unicode
internally everywhere else. If you wanted to be consistent you could just
use utf16 for everything instead of UTF8. I like utf8 because of its
compactness, personally.

But up to you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list