Issue 119933 - Starbasic command FORMAT fails when changing accented character to ALL CAPS
Summary: Starbasic command FORMAT fails when changing accented character to ALL CAPS
Status: CLOSED FIXED
Alias: None
Product: App Dev
Classification: Unclassified
Component: scripting (show other issues)
Version: 3.4.0
Hardware: All All
: P3 Normal
Target Milestone: 4.0.0
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 121368
  Show dependency tree
 
Reported: 2012-06-09 14:01 UTC by rgb
Modified: 2017-05-20 09:32 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Calc sample file with macro (13.51 KB, application/vnd.oasis.opendocument.spreadsheet)
2012-06-09 14:01 UTC, rgb
no flags Details
Screenshot from the sample calc document (10.94 KB, image/png)
2012-06-09 14:07 UTC, rgb
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description rgb 2012-06-09 14:01:57 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 á, é, ñ...
Comment 1 rgb 2012-06-09 14:07:22 UTC
Created attachment 78211 [details]
Screenshot from the sample calc document

The attached screenshot shows the sample document and the problem reported here.
Comment 2 Terry 2012-06-10 04:26:43 UTC
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
Comment 3 rgb 2012-06-10 11:38:21 UTC
(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.
Comment 4 Ariel Constenla-Haile 2012-06-10 16:30:42 UTC
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;
}
Comment 5 Ariel Constenla-Haile 2012-06-10 17:20:49 UTC
Fixed in Revision 1334984