tis 2007-05-29 klockan 16:08 -0300 skrev Gabriel Genellina:
> sys.stdout = filewrapper(sys.stdout, 'utf-8')
> print u"åäö \N{GREEK CAPITAL LETTER DELTA}"
> >
> > Useful if you don't want to append .encode() to everything you print out
> > that potentially can contain non-ascii letters.
>
En Tue, 29 May 2007 15:16:52 -0300, Ragnar Ouchterlony
<[EMAIL PROTECTED]> escribió:
> If I for some reason can't open the object myself or needs encoding on
> other file-like objects, I think the following wrapper function is of
> use (it essentially does what codecs.open() does but takes a fil
tis 2007-05-29 klockan 09:05 +0200 skrev "Martin v. Lo"wis":
> Yes, when writing to a file, you need to define an encoding, e.g.
>
> self.file.write(data.encode("utf-8"))
>
> You can use codecs.open() instead of open(),
> so that you can just use self.file.write(data)
If I for some reason can't
En Tue, 29 May 2007 04:24:15 -0300, 人言落日是天涯,望极天涯不见家
<[EMAIL PROTECTED]> escribió:
> On 5月29日, 下午3时05分, "Martin v. Lo"wis" <[EMAIL PROTECTED]> wrote:
>> > yes, it could print to the terminal(cmd.exe), but when I write these
>> > string to file. I got the follow error:
>>
>> > File "E:\Tools\fi
On 5月29日, 下午3时05分, "Martin v. Lo"wis" <[EMAIL PROTECTED]> wrote:
> > yes, it could print to the terminal(cmd.exe), but when I write these
> > string to file. I got the follow error:
>
> > File "E:\Tools\filegen\filegen.py", line 212, in write
> > self.file.write(data)
> > UnicodeEncodeError:
> yes, it could print to the terminal(cmd.exe), but when I write these
> string to file. I got the follow error:
>
> File "E:\Tools\filegen\filegen.py", line 212, in write
> self.file.write(data)
> UnicodeEncodeError: 'ascii' codec can't encode character u'\u0394' in
> position 0
> : ordinal
On 5月29日, 下午1时34分, "Martin v. Lo"wis" <[EMAIL PROTECTED]> wrote:
> 人言落日是天涯,望极天涯不见家 schrieb:
>
> > I lookup the utf-8 form of delta from the link.
> >http://www.fileformat.info/info/unicode/char/0394/index.htm
>
> > and then I want to print it in the python ( I work under windows)
>
> > #!/usr/bin/p
人言落日是天涯,望极天涯不见家 schrieb:
> I lookup the utf-8 form of delta from the link.
> http://www.fileformat.info/info/unicode/char/0394/index.htm
>
> and then I want to print it in the python ( I work under windows)
>
> #!/usr/bin/python
> #coding=utf-8
>
> print "\xce\x94"
>
> but the result is not the
I lookup the utf-8 form of delta from the link.
http://www.fileformat.info/info/unicode/char/0394/index.htm
and then I want to print it in the python ( I work under windows)
#!/usr/bin/python
#coding=utf-8
print "\xce\x94"
but the result is not the 'delta' but an unknown character.
--
http://