Mingye Wang added the comment: The "join the web people" solution should look like this:
$ diff -Naurp a/_codecs_cn.c b/_codecs_cn.c --- a/_codecs_cn.c 2016-10-09 14:24:04.675111500 -0700 +++ b/_codecs_cn.c 2016-10-09 14:27:06.600961500 -0700 @@ -128,6 +128,12 @@ ENCODER(gbk) continue; } + if (c == 0x20AC) { /* cp936, or web GBK */ + WRITEBYTE1((unsigned char)0x80); + NEXT(1, 1); + continue; + } + if (c > 0xFFFF) return 1; @@ -159,6 +165,12 @@ DECODER(gbk) NEXT_IN(1); continue; } + + if (c == 0x80) { /* cp936, or web GBK */ + OUTCHAR(0x20AC); + NEXT_IN(1); + continue; + } REQUIRE_INBUF(2); It should be mostly safe as this character is not previously defined in Python's GBK implementation. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28343> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com