WideStringReplace bug?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

WideStringReplace bug?

Lubos Pintes
Hello,,
I am developing a console program which receives input in UTF-8, but it
is converted to WideString for communication with COM.
I found a weird behaviour of the WideStringReplace, and I extracted the
small program below:
program a;
{$apptype console}

uses SysUtils;

var
   U: UTF8String;
   W: WideString;

begin
   U := 'left[*]paren';
   W := WideStringReplace(WideString(U), WideString('[*]'), WideString('
'), [rfReplaceAll]);
   writeln(W);
end.

It seems to me that the output is garbaged, and it is not a problem of
writeln, because I also obtained the weird result which was sent to SAPI.

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WideStringReplace bug?

Lubos Pintes
Sorry I forgot the FPC version:
3.1.1 [2017/02/15] for i386
Dňa 28. 3. 2017 o 11:22 Lubos Pintes napísal(a):

> Hello,,
> I am developing a console program which receives input in UTF-8, but it
> is converted to WideString for communication with COM.
> I found a weird behaviour of the WideStringReplace, and I extracted the
> small program below:
> program a;
> {$apptype console}
>
> uses SysUtils;
>
> var
>   U: UTF8String;
>   W: WideString;
>
> begin
>   U := 'left[*]paren';
>   W := WideStringReplace(WideString(U), WideString('[*]'), WideString('
> '), [rfReplaceAll]);
>   writeln(W);
> end.
>
> It seems to me that the output is garbaged, and it is not a problem of
> writeln, because I also obtained the weird result which was sent to SAPI.
>
> _______________________________________________
> fpc-pascal maillist  -  [hidden email]
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Loading...