Microsoft KB Archive/297133

= PRB: UPPER Function Operates on High-ASCII Characters =

Article ID: 297133

Article Last Modified on 5/12/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition
 * Microsoft Visual FoxPro 5.0 Standard Edition
 * Microsoft Visual FoxPro 5.0a
 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q297133



SYMPTOMS
When you use the UPPER function on strings that include high-ASCII characters, you may see unexpected changes.



CAUSE
Visual FoxPro makes characters uppercase that are considered alphabetic by the ISALPHA function. ISALPHA is not font-dependent, so fonts that include symbol characters appear to behave incorrectly when strings that are displayed in them are run through the UPPER function.



RESOLUTION
If you must use symbol characters in your uppercase strings, test each character and make it uppercase individually. lcOldFontName = _SCREEN.FontName lnOldFontSize = _SCREEN.FontSize _SCREEN.FontName = &quot;FoxFont&quot; _SCREEN.FontSize = 9

lcMixedString = &quot;Value is 500&quot; + CHR(241) + &quot;0.05%&quot; ? lcMixedString ? UPPER(lcMixedString) && Displays box character
 * !* 241 is the plus/minus character.

lcUpperString = &quot;&quot; FOR i = 1 TO LEN(lcMixedString) lcCurrChar = SUBSTR(lcMixedString, i, 1) IF BETWEEN(lcCurrChar, &quot;a&quot;, &quot;z&quot;) lcCurrChar = UPPER(lcCurrChar) ENDif lcUpperString = lcUpperString + lcCurrChar ENDfor

? lcUpperString

_SCREEN.FontName = lcOldFontName _SCREEN.FontSize = lnOldFontSize



STATUS
This behavior is by design.



MORE INFORMATION
To see all characters that are affected by UPPER, run the following code: _SCREEN.FontName = &quot;Lucida Sans Unicode&quot; CLEAR

FOR i = 1 TO 255 IF CHR(i) != UPPER(CHR(i)) ? i, CHR(i), UPPER(CHR(i)) ENDif ENDfor NOTE: Change the FontName property to &quot;FoxFont&quot; to see the problem that is described in the &quot;Symptoms&quot; section.

