Re: [OT] C++ coding

IIRC the very point of UTF-8 vs. wide characters is that it
is platform independent, and the underlying data type is always char
(but it breaks assumption that character fits in int).

How long will it take to make a Chinese version?" The correct
> answer is not “A couple months” but “How soon can you get the Chinese
> translator here?”

These days it goes backwards. Development migrates to China/India,
so they get their local version first :frowning:
–pa

On 26-Oct-2011 19:10, xxxxx@flounder.com wrote:

Yes, I know there are lots of non-Windows systems out there, and I even
have a book about International Programming usin *nix, which urges that
the type ‘char’ be abandoned in favor of wide characters. Note that
wchar_t size is platform-dependent, but if you use a platform-neutral type
like TCHAR or WCHAR, they will generate wchar_t if you use the standard
libraries. Key here is to stop assuming ‘char’ has meaning. If this
week, the typedefs generate ‘char’, that’s OK, but next week, when your
boss comes in and says “We’ve just made a great sale to China, millions of
dollars. How long will it take to make a Chinese version?” The correct
answer is not “A couple months” but “How soon can you get the Chinese
translator here?”

(And yes, it happened to me, and the second answer was the one I gave;
although it wasn’t China it was a country that requires wchar_t. THe sale
was less than a million dollars, but it made a nice revenue spike that
quarter for the company).

The book is “Programming for the World: A Guide to Internationalization”,
by Sandra Martin O’Donnell, Prentice-Hall, 1994. (Note the copyright
date! Even *nix people should have know about this problem for the last
17 years! Some did. I read it many years ago and I have not used ‘char’
since, except in aforementioned rare and exotic situations).
joe

> On 26-Oct-2011 02:42, xxxxx@flounder.com wrote:
> …
>
>> In fact if you look in the old MFC newsgroup, I really beat up people
>> who
>> write
>>
>> char buffer[80];
>>
>> This is wrong for several reasons that should be obvious
>> (a) in app space, ‘char’ is used only in rare and exotic contexts. For
>> characters, use either TCHAR or go all the way and use WCHAR, but never
>> ‘char’, which I usually think of as an obsolete data type for nearly all
>> uses.
>
> Unfortunately this seems to be so only for Windows, which
> uses UTF16. But *nix (most of the world) tends to use UTF-8
> and the type for it is… char, what else?
> For wide chars they use 32-bit or even 64-bit ints.
>
> Regards,
> – pa
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>