![]() |
wchar_t and wide characters
Do Standard C's wide characters and wide strings require absolutely
that each character be stored in a single wchar_t, or can characters be "multi-wchar_t" in the same way that they can be multibyte? Is it a requirement that the number of wchar_t's in a string is the same as the number of characters in the string (give or take the terminal null character)? The particular case I'm puzzling over is whether or not it is conforming for an implementation with a 16-bit wchar_t to use UTF-16 as a character encoding, since this would require some characters to be endoded as two wchar_t's. I understand that this is what one popular C-like implementation does. |
Re: wchar_t and wide characters
<jjf@bcs.org.uk> wrote in message
news:1142250214.629389.6090@u72g2000cwu.googlegrou ps.com... > Do Standard C's wide characters and wide strings require absolutely > that each character be stored in a single wchar_t, or can characters be > "multi-wchar_t" in the same way that they can be multibyte? Is it a > requirement that the number of wchar_t's in a string is the same as the > number of characters in the string (give or take the terminal null > character)? > > The particular case I'm puzzling over is whether or not it is > conforming for an implementation with a 16-bit wchar_t to use UTF-16 as > a character encoding, since this would require some characters to be > endoded as two wchar_t's. I understand that this is what one popular > C-like implementation does. The *intent* is that an array of wchar_t use one element to store each character. Certainly all the added wide-character functions implicitly assume so. There's nothing stopping an implementation from using UTF-16 as a wide-character encoding, however, and not living up to this intent. Indeed, as you observe, UTF-16 is now used in implementations that thought UCS-2 would be sufficient a decade ago. Some of us have bowed to the inevitable and now supply the necessary conversion software to support what you call multi-wchar_t encodings. P.J. Plauger Dinkumware, Ltd. http://www.dinkumware.com |
| All times are GMT. The time now is 10:09 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.