Re: [Draft] Writing i18n apps with glibc 2.2
[ seems the gateway on e-fever is down again. -_- someday I'm gonna write
a better bbs gateway program ... ]
On Mon, Oct 16, 2000 at 08:53:17PM +0800, Isaac Kar-Keung To wrote:
> >>>>> "Roger" == Roger So <firstname.lastname@example.org> writes:
> Roger> So, given a stream of bytes which might contain multibyte
> Roger> characters, how would I test whether a byte is, say, printable?
> Roger> Do I need to test for MB_CUR_MIN to MB_CUR_MAX number of bytes
> Roger> instead of individual bytes? (seems wildly inefficient ...)
> Or is it that when MB_CUR_MAX!=1, you really shouldn't "check whether a byte
> is printable"? It doesn't make much sense to me: even if 0xA6 or 0xA7
> appear as a byte in a BIG5 character, there is no guarantee that D8A7, say,
> is a valid BIG5! So it's neither "printable" nor "unprintable"...
No, the point I was making was, say you have 0x20 0xD0 0xF6 (a space
followed by some Big5 character). First you check isprint(0x20); that
succeeds, so you move on to isprint(0xD0). Oops, 0xD0 is not printable.
But MB_CUR_MAX = 2. So we check it now with 2 bytes together ...
isprint(0xD0F6) ... great, that's printable, and we move on to the next
Roger So telnet://e-fever.org
spacehunt at e-fever dot org SysOp, e-Fever BBS
GnuPG 1024D/98FAA0AD F2C3 4136 8FB1 7502 0C0C 01B1 0E59 37AC 98FA A0AD
| This message was re-posted from email@example.com
| and converted from big5 to gb2312 by an automatic gateway.