[Patches] [ python-Patches-479898 ] Multibyte string on string::string_print

noreply@sourceforge.net noreply@sourceforge.net
Tue, 04 Dec 2001 11:08:50 -0800


Patches item #479898, was opened at 2001-11-08 23:10
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=479898&group_id=5470

Category: Core (C code)
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Hye-Shik Chang (perky)
Assigned to: Nobody/Anonymous (nobody)
Summary: Multibyte string on string::string_print

Initial Comment:
Many multibyte language users are difficult to see 
native characters on list or dictionary and etc.
This patch allows printing multibyte on UNIX98-
compatible machines; mbtowc() is ISO/IEC 9899:1990 
standard C-API function.


----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-04 11:08

Message:
Logged In: YES 
user_id=6380

I don't understand the point of using mbtowc() here.

The code extracts a wide character, but then it uses
isprint() on it, and as far as I know, isprint() is not
defined on wide characters, only on 'unsigned char' (and on
-1).

Isn't what the author wants simply to is isprint(c) instead
of (c < ' ' || c >= 0x7f)???

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2001-11-09 13:21

Message:
Logged In: YES 
user_id=21627

Even though I think this patch is correct in principle, I
see a few problems with it:
1. Since it doesn't fix a bug, it probably cannot go into 2.2.
2. There is no autoconf test for mbtowc. You should test
this in configure, and then conditionalize your code on
HAVE_MBTOWC.
3. There is too much code duplication. Try to find a
solution which special-cases the escape codes (\something)
only once. For example, you may implement a trivial mbtowc
redefinition if mbtowc is not available, and then use mbtowc
always.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=479898&group_id=5470