"Greg Turner" gmturner007@ameritech.net wrote:
It's better to create a correct multibyte character pair and call GetStringType then.
you mean this beast?
BOOL GetStringTypeW( DWORD dwInfoType, // information-type options LPCWSTR lpSrcStr, // source string int cchSrc, // number of characters in string LPWORD lpCharType // output buffer );
You are probably far better informed on these issues than I, but this seems slightly excessive to me -- or, perhaps I'm suffering from sour grapes syndrome, since I'm somewhat out of my element here (I seem to be saying that a lot lately don't I? When, I wonder, will I start to feel that I am /in/ my element?? (Probably not until wine is written in Kylix ... man, that's embarassing!!))
My patch was intended to be a clone of the similar implementations I saw in the same unit, not a full implementation.
But... since I seem to be volunteering to implement the function, I guess I should do it right...
So, on second thought, merged or no, I'll try to whip up a better version of _ismbc* and maybe, if I'm feeling especially cool, some others in the vicinity, using GetStringType as you reccomend.
try something like this (completely not tested):
int _ismbcalpha(unsigned int ch) { char mbch[2]; WCHAR chW; WORD ctype;
mbch[0] = ch & 0xff; mbch[1] = (ch >> 8) & 0xff; MultiByteToWideChar(CP_ACP, 0, mbch, 2, &chW, 1); GetStringTypeW(CT_CTYPE1, &chW, 1, &ctype); return (ctype & C1_ALPHA) != 0; }
I'm not sure whether mbch[0] and mbch[1] should be actually swapped, in the case if multibyte character was passed in.