Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: "Mihai N." <nmihai_year_2000@xxxxxxxxx>
- Date: Mon, 12 Dec 2005 22:41:14 -0800
> I agree, but if we have _mbslen for 8-bit shouldn't we also have
> something for 16-bit? Even if people won't use it!
_mbslen has the same problems with ligatures and such.
But yes, what we would probably need is a "linguistic character length"
> I'm not sure there is anything missing that I need; I was just trying to
> find out if WideCharToMultiByte() was UCS-2 or UTF-16, and was puzzled
> that the MS documentation does not seem to address this issue. For my
> application it is extremely unlikely to matter.
This is usually the case :-)
But short unswer: is UCS-2 for WinNT&W9x and UTF-16 for newer systems.
And the only code page where it matters is GB18030, which is not supported at
all on old systems.
> Sorry, I didn't mean to imply that MS (or others) were idiots, but I do
> think they might not have made this decision if they had known that
> Unicode would expand beyond UCS-2. I believe there are Unix/Linux
> systems where the operating system uses UTF-8 and wchar_t is 32 bits,
> and I feel that this might be easier to use than UTF-16.
I still think utf-16 is a good choice even when knowing that 16 bits is not
enough. The ICU and Xerces made this choice quite recently and the the link
to the Unicode FAQ explains some of the "why".
But yes, most Unix/Linux systems use utf-8 in the kernel, file systems, and
other places where it does not matter and being agnostic works ok.
And wchar_t is 32 on many Linux systems, and some popular libraries are using
it (for example wxWidgets).
But the main basic principle is still the same:
- utf-7, utf-8 are good not to break legacy applications/libraries and to
move stuff arround
- utf-16, utf-32 are good when the strings should be processed
> Anyway, I think I understand. Later versions of Windows (XP in
> particular) support UTF-16, but earlier ones are just UCS-2.
Right :-)
--
Mihai Nita [Microsoft MVP, Windows - SDK]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
.
- References:
- Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: Sajal
- Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: Mihai N.
- Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: David Wilkinson
- Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: Mihai N.
- Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: David Wilkinson
- Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: Mihai N.
- Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- From: David Wilkinson
- Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- Prev by Date: Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- Next by Date: Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- Previous by thread: Re: Is WideCharToMultiByte(...) works fine If unicode char is more than 2 byte???
- Next by thread: JOBS, Momentum Technologies.... Contact ASAP
- Index(es):
Relevant Pages
|