Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-08 Thread higer
Thank you Mark, that works. Firstly using 'string-escape' to decode the content is the key point,so I can get the Chinese characters now. Regards, -higer -- http://mail.python.org/mailman/listinfo/python-list

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread Mark Tolonen
"higer" wrote in message news:0c786326-1651-42c8-ba39-4679f3558...@r13g2000vbr.googlegroups.com... On Jun 7, 11:25 pm, John Machin wrote: On Jun 7, 10:55 pm, higer wrote: > My file contains such strings : > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a Are you sure? Does that occupy 9 bytes in

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread R. David Murray
John Machin wrote: > On Jun 8, 12:13 am, "R. David Murray" wrote: > > higer wrote: > > > My file contains such strings : > > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > > > If those bytes are what is in the file (and it sounds like they are), > > then the data in your file is not in UTF8 encoding

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread higer
On Jun 8, 8:20 am, MRAB wrote: > John Machin wrote: > > On Jun 8, 12:13 am, "R. David Murray" wrote: > >> higer wrote: > >>> My file contains such strings : > >>> \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > >> If those bytes are what is in the file (and it sounds like they are), > >> then the data in

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread higer
On Jun 7, 11:25 pm, John Machin wrote: > On Jun 7, 10:55 pm, higer wrote: > > > My file contains such strings : > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > Are you sure? Does that occupy 9 bytes in your file or 36 bytes? > It was saved in a file, so it occupy 36 bytes. If I just use a variabl

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread John Machin
On Jun 8, 10:20 am, MRAB wrote: > John Machin wrote: > > On Jun 8, 12:13 am, "R. David Murray" wrote: > >> higer wrote: > >>> My file contains such strings : > >>> \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > >> If those bytes are what is in the file (and it sounds like they are), > >> then the data i

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread MRAB
John Machin wrote: On Jun 8, 12:13 am, "R. David Murray" wrote: higer wrote: My file contains such strings : \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a If those bytes are what is in the file (and it sounds like they are), then the data in your file is not in UTF8 encoding, it is in ASCII encoded a

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread John Machin
On Jun 8, 12:13 am, "R. David Murray" wrote: > higer wrote: > > My file contains such strings : > > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a > > If those bytes are what is in the file (and it sounds like they are), > then the data in your file is not in UTF8 encoding, it is in ASCII > encoded as hexi

Re: how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread John Machin
On Jun 7, 10:55 pm, higer wrote: > My file contains such strings : > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a Are you sure? Does that occupy 9 bytes in your file or 36 bytes? > > I want to read the content of this file and transfer it to the > corresponding gbk code,a kind of Chinese character encod

how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread R. David Murray
higer wrote: > My file contains such strings : > \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a If those bytes are what is in the file (and it sounds like they are), then the data in your file is not in UTF8 encoding, it is in ASCII encoded as hexidecimal escape codes. > I want to read the content of this

how to transfer my utf8 code saved in a file to gbk code

2009-06-07 Thread higer
My file contains such strings : \xe6\x97\xa5\xe6\x9c\x9f\xef\xbc\x9a I want to read the content of this file and transfer it to the corresponding gbk code,a kind of Chinese character encode style. Everytime I was trying to transfer, it will output the same thing no matter which method was used. I