[Mediawiki-l] xml import parse error on plusmn entity

Brion Vibber brion at wikimedia.org
Fri Jun 20 18:15:56 UTC 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jim Hu wrote:
> I'm thinking this may be a php bug rather than a mw problem - but I'm  
> wondering how to get around it.  I generate MW xml for importing pages  
> and I use htmlentities to encode things for xml.  But I just saw a  
> problem with the XML parser failing to recognize the ± entity.

± has no inherent meaning in XML; it would have to be defined via
the doctype or directly in a processor directive in the document.

Instead of htmlentities(), use htmlspecialchars() which is safe for XML
by only using the XML-predefined character references &, <, >,
and ".

Ensure your text is properly encoded (eg, UTF-8 unless your XML file is
otherwise marked.)

- -- brion
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkhb89wACgkQwRnhpk1wk46knwCg1RlfJYUT18TEaG3djFCQpKDR
VjkAnR9vMF0r3gWHl3B2cgcrz1RivwTE
=3qsd
-----END PGP SIGNATURE-----



More information about the MediaWiki-l mailing list