[Python-Dev] Internationalization Toolkit
Fred L. Drake, Jr.
fdrake@acm.org
Wed, 10 Nov 1999 10:58:30 -0500 (EST)
M.-A. Lemburg writes:
> def encode(self,u):
>
> """ Return the Unicode object u encoded as Python string.
This should accept an optional slice parameter, and use it in the
same way as .dump().
> def dump(self,u,stream,slice=None):
...
> def load(self,stream,length=None):
Why not have something like .wrapFile(f) that returns a file-like
object with all the file methods implemented, and doing to "right
thing" regarding encoding/decoding? That way, the new file-like
object can be used directly with code that works with files and
doesn't care whether it uses 8-bit or unicode strings.
> Codecs should raise an UnicodeError in case the conversion is
> not possible.
I think that should be ValueError, or UnicodeError should be a
subclass of ValueError.
(Can the -X interpreter option be removed yet?)
-Fred
--
Fred L. Drake, Jr. <fdrake@acm.org>
Corporation for National Research Initiatives