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

John Machin sjmachin at
Sun Jun 7 20:32:58 EDT 2009

On Jun 8, 10:20 am, MRAB <pyt... at> wrote:
> John Machin wrote:
> > On Jun 8, 12:13 am, "R. David Murray" <rdmur... at> wrote:
> >> higer <higerinbeij... at> 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.
> > OK, I'll bite: what *ASCII* character is encoded as either "\xe6" or
> > r"\xe6" by what mechanism in which parallel universe?
> Maybe he means that the file itself is in ASCII.

Maybe indeed, but only so because hex escape codes are by design in
ASCII. "in ASCII" is redundant ... I can't imagine how the OP parsed
"ASCII <omitted 'because it is'> encoded" given that his native
tongue's grammar varies from that of English in several interesting
ways :-)

More information about the Python-list mailing list