Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2017-03

WideStringReplace bug?

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

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.

Reply by email

Lubos Pintes
to 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):

Show quoted text 27 lines
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 - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply by email