[fpc-devel] Unnecessary string copy from Utf8String to AnsiString if destination CP is UTF8

J. Gareth Moreton gareth at moreton-family.com
Sun Apr 28 14:57:52 CEST 2019


Probably not, as you've already addressed it yourself.  It was regarding 
Jonas' comment about the empty string being returned if orgcp is neither 
cp or CP_NONE - I didn't check it myself but went by his word.

Gareth


On 28/04/2019 13:14, Ondrej Pokorny wrote:
> On 28.04.2019 13:45, J. Gareth Moreton wrote:
>> Personally I'm fine with people refactoring code in order to improve 
>> performance in either the compiler or the programs it compiles, just 
>> so long as it behaves exactly the same as before (which in this case, 
>> it doesn't because of the empty string issue that Jonas mentioned).
>
> What empty string issue? Did I miss something?
>
> program AnsiUtf8;
> var
>   Utf8Str: UTF8String;
>   Str: AnsiString;
> begin
>   DefaultSystemCodePage := 1250;
>   Utf8Str := 'hello';
>   Str := Utf8Str;
>   Writeln(Str);
> end.
>
> Ondrej
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
>
>

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus




More information about the fpc-devel mailing list