Apache OpenOffice (AOO) Bugzilla – Issue 119933
Starbasic command FORMAT fails when changing accented character to ALL CAPS
Last modified: 2017-05-20 09:32:05 UTC
Created attachment 78210 [details] Calc sample file with macro When using the command FORMAT with the parameter > in order to change text on a Calc cell to ALL CAPS, nothing happens with accented characters. For example, "sábado" change to "SáBADO" instead of "SÁBADO". On the attached file you'll find a macro that use this instruction to give format to the data, showing the failure on characters like á, é, ñ...
Created attachment 78211 [details] Screenshot from the sample calc document The attached screenshot shows the sample document and the problem reported here.
If uCase is used in the 'bad' function, it works: Function myBadUCase(x) dim y as string y = format( x , "nn dd/mmm/yy") y = format( y , ">") y = uCase ( y ) myBadUCase = y end function
(In reply to comment #2) > If uCase is used in the 'bad' function, it works: uCase(y) should be equivalent to format( y , ">") In fact, if you look at function myUCase on the macro example you'll see that uCase was used so it is clear that that instruction works, but that do not solve the original problem with "format" and ">": By adding uCase after "format" you are performing the same action twice, the only difference is that the second time it works while the first time it fails. Just to make it clear, this report is not about a difficulty to change accented characters to caps, but about the failure of "format" command on performing the task.
The issue is that void SbxValue::Format( XubString& rRes, const XubString* pFmt ) const uses ToLowerAscii() and ToUpperAscii(), what obviously does not work with non ASCII characters: if( pFmt->EqualsIgnoreCaseAscii( VBAFORMAT_LOWERCASE ) ) { rRes = aStr.ToLowerAscii(); return; } if( pFmt->EqualsIgnoreCaseAscii( VBAFORMAT_UPPERCASE ) ) { rRes = aStr.ToUpperAscii(); return; }
Fixed in Revision 1334984