[Expat-discuss] how to support GBK encoding

Marco Maggi marco.maggi-ipsu at poste.it
Sun Aug 25 11:06:32 CEST 2013


Lee Rick wrote:
> I  encountered  a issue.When  I  parse  the xml  with  GBK
> encoding, some can  be parsed,some can not  be parsed, how
> to make it support the all GBK encoding xml file?

GBK is not an Expat's built-in encoding; you should read the
relevant  documentation sections[1][2],  and see  if Expat's
API can be  adapted for GBK.  Notice that  the "iconv()" API
supports the GBK encoding, so you can use it in a first-stab
solution  to see  how it  goes.   You can  take my  untested
Gist[4] as  starting point (if  possible, let me know  if it
works).

[1] <http://marcomaggi.github.io/docs/expat.html#using-encodings>
[2] <http://marcomaggi.github.io/docs/expat.html#api-handlers-encoding>
[3] <http://en.wikipedia.org/wiki/GBK>
[4] <https://gist.github.com/marcomaggi/6332826>
-- 
Marco Maggi


More information about the Expat-discuss mailing list