[Python-Dev] Re: Multibyte repr() (original) (raw)

Atsuo Ishimoto ishimoto@gembook.org
Fri, 11 Oct 2002 08:06:33 +0900


Hello,

On Thu, 10 Oct 2002 08:59:26 -0400 Guido van Rossum <guido@python.org> wrote:

[Guido] > > Well, if you want to see the hex codes for all non-ASCII characters, > > repr() used to be your friend. No more. If you want to see the > > printable characters, you could always use print.

[Atsuo Ishimoto] > I'm happy with this. "This" was ambiguous. Are you happy with what's in current CVS, or with the old repr()?

Sorry. I meant I'm happy with current CVS.

I tried this, and I could not find any problems with the resulting pickle. The pickle looks like this:

"S'\x83\\'\np0\n." I couldn't get this to fail loading in Python 2.1, 2.2 or 2.3 (CVS); I tried both pickle and cPickle.

May be you tried with ascii or latin-1 locale. But with Japanese ShiftJIS encoding, you'll see the traceback on unpickling. I tried CVS version of python on Japanese edition of Win2000, I got:

Traceback (most recent call last): File "", line 1, in ? File "C:\cygwin\home\ishimoto\wk\python\dist\src\lib\pickle.py", line 1071, in loads return Unpickler(file).load() File "C:\cygwin\home\ishimoto\wk\python\dist\src\lib\pickle.py", line 675, in load dispatchkey File "C:\cygwin\home\ishimoto\wk\python\dist\src\lib\pickle.py", line 754, in load_string self.append(rep.decode("string-escape")) ValueError: Trailing \ in string


Atsuo Ishimoto ishimoto@gembook.org Homepage:http://www.gembook.jp