[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
UNIBYTE_STR_AS_MULTIBYTE_P and UTF-8
From: |
Chip Coldwell |
Subject: |
UNIBYTE_STR_AS_MULTIBYTE_P and UTF-8 |
Date: |
Thu, 26 Oct 2006 14:57:01 -0400 (EDT) |
I'm looking at the C macro UNIBYTE_STR_AS_MULTIBYTE_P defined in
src/charset.h, which starts out with this
#define UNIBYTE_STR_AS_MULTIBYTE_P(str, length, bytes) \
(((str)[0] < 0x80 || (str)[0] >= 0xA0) \
? ((bytes) = 1) \
: /* lots, lots more */
So, if the value at str[0] is less than 0x80 or greater than 0xA0,
this macro returns the value one, and sets "bytes" to one.
That's fine for ASCII (always one byte wide) and ISO-8859-1 (with
special characters between 0xA0 and 0xFF), but what about UTF-8?
There are multibyte characters in UTF-8 with the first byte > 0xA0; it
doesn't seem to me that this macro will work for general UTF-8
strings.
Chip
--
Charles M. "Chip" Coldwell
Senior Software Engineer
Red Hat, Inc
978-392-2426
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- UNIBYTE_STR_AS_MULTIBYTE_P and UTF-8,
Chip Coldwell <=