What type to use for code page values

by Michael S. Kaplan, published on 2007/04/29 03:21 -04:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/04/29/2322357.aspx


I was asked via the Contact link:

Why does CharPrevExA/CharNextExA take a WORD for code page, whereas MultiByteToWideChar takes a UINT? Which type should I use to store code pages?

It is true that CharNextExA and CharPrevExA take WORD values for code pages, while MultiByteToWideChar and WideCharToMultiByte take UINT values.

But then as I pointed out in Is CharNextExA broken?, those two functions that take WORD values don't handle code pages greater than a WORD even though such code pages exist.

So the functions named are able to accept all of the code pages values that they can respectively handle.

To answer the question about what type to use to store code pages, the same rule could be followed -- use the type that is able to handle all of code pages that your code can handle....

 

This post bought to you by(U+1654, a.k.a. CANADIAN SYLLABICS CARRIER SHU)


no comments

go to newer or older post, or back to index or month or day