[XML-SIG] PyExpat changes for encoding (was: XML support in Python 1.6)
Greg Stein
gstein@lyra.org
Fri, 2 Jun 2000 08:17:32 -0700 (PDT)
On Fri, 2 Jun 2000, Andrew M. Kuchling wrote:
>...
> parser.nativeEncoding() -> returns "UTF-8" or "UTF-16"
pyexpat.native_encoding as a readonly attribute. I see no particular use
in making it a function. (Note the module-level, too!)
> parser.requestUTF8( ) causes the parser to return UTF-8-encoded 8-bit
> strings; by default Unicode strings will be returned.
parser.returns_unicode as an 0/1-valued attribute (1 is the default)
Again: no need for a function, and the attribute solves both the get and
set cases. An alternate would be a .output_encoding attribute that is
string-valued.
>...
> * What do we assume for old versions of Expat? I guess all we
> can do is assume UTF-8, and trust that the strangeness will
> be apparent if it was compiled for UTF-16.
Agreed -- I think you need to assume UTF-8.
Cheers,
-g
--
Greg Stein, http://www.lyra.org/