From: Paul N on
I'm writing a small program which reads an input from one edit box,
converts it in some way and sends the output to another edit box.
Suppose I have put "aäAÄ" into the first edit box, where the second
character is a-umlaut (Alt-132) and the fourth is A-umlaut (alt-142).

If I convert it using

for (p = from; *p; p++) { if (_istlower(*p)) *p = '1'; else *p =
'0'; }

then I get the result "1100" which is what I would expect. However, if
I convert it using:

for (p = from; *p; p++) { if (_istlower(*p)) *p = _totupper(*p); }

then I get the result "AäAÄ" - the normal a gets converted properly
but a-umlaut does not. I was a bit surprised at this, as I would have
thought that if it can correctly tell whether ä and Ä are upper and
lower case then it should be able to convert them properly.

I'm using the default settings for VC++, so TCHAR is WCHAR, _istlower
is iswlower and _totupper is towupper.

Am I doing something wrong, or am I just being optimistic in what
_totupper can do? If so, is there anything else I can use?

Many thanks.
Paul.
From: Jackie on
Paul N wrote:
>..

My only guess is that it does not consider locale.
From http://www.cplusplus.com/reference/clibrary/cctype/islower/:
"Notice that what is considered a letter may depend on the locale being
used; In the default C locale, a lowercase letter is any of: a b c d e f
g h i j k l m n o p q r s t u v w x y z."

"a locale-specific template version of this function (islower) exists in
header <locale>."

Maybe you should try this:
http://www.cplusplus.com/reference/std/locale/islower/

--
Regards,
Jackie
From: Jackie on
Jackie wrote:
> ...

Or in your case, _istlower_l or _totupper_l.

http://msdn.microsoft.com/en-us/library/1z2s6by9.aspx
http://msdn.microsoft.com/en-us/library/45119yx3.aspx

--
Regards,
Jackie