View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0021931LazarusLCLpublic2012-05-03 13:192013-08-17 13:49
Reporterlingling 
Assigned ToBart Broersma 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionunable to reproduce 
PlatformOSOS Version
Product Version0.9.30.2Product Build 
Target VersionFixed in Version 
Summary0021931: stringreplace have not right result
Descriptionthis code ,the result right is : 你们好sde

but the result is : 大家好sde

why,must be delete 'sde' can show right result.

how to return the right result ?

my windows is chinese edition.

procedure TForm1.Button1Click(Sender: TObject);
var
 aStr:String;
begin
 aStr:='大家好sde';
 aStr:=StringReplace(aStr,'大家好','你们好',[rfReplaceAll, rfIgnoreCase]);
 showmessage(aStr);
end;
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64, WinCE
Attached Filespng file icon StringReplace.png [^] (21,509 bytes) 2012-05-05 18:01


zip file icon StringReplace.zip [^] (2,413 bytes) 2012-05-05 18:02

- Relationships
related to 0022148resolvedMattias Gaertner UTF8StringReplace 

-  Notes
(0059261)
Bart Broersma (developer)
2012-05-05 18:04

I cannot reproduce this with Lazarus 1.1 (Lazarus 1.1 r37066 FPC 2.6.0 i386-win32-win32/win64)

See attached screenshot: I copied the strings form this report.

Can you test with Lazarus trunk with attached sample program?
(0059326)
lingling (reporter)
2012-05-07 02:51
edited on: 2012-05-07 02:52

hello,i run your project in lazarus 0.9.30.2,but this code can't run,show error:


begin
  RequireDerivedFormResource := True;
 
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.

and i delete the code: RequireDerivedFormResource := True;

then run it ,but the reselt is still error is: 大家好sde

when i tryied change the options in:

procedure TForm1.Button1Click(Sender: TObject);
var
 aStr:String;
begin
 aStr:='大家好sde';
 aStr:=StringReplace(aStr,'大家好','你们好',[rfReplaceAll]);
 showmessage(aStr);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
 aStr:String;
begin
 aStr:='大家好sde';
 aStr:=StringReplace(aStr,'大家好','你们好',[]);
 showmessage(aStr);
end;

the result is right ,but can't upper lowercase letters.

why??? i think it is a bug in fpc tsearch unit, can you modify it to right?

(0059348)
Bart Broersma (developer)
2012-05-07 11:36

There will be no more fixes for the 0.9.30 branch AFAIK, so please test with trunk.
If it fails then please attach a screenshot (from my program) because most of the time I cannot read your characters in the browser (depends on my current machine and OS).

If I underatnd you correctly the problem appears to be in the Uppercase part (and all is correct with lowercase)?
In that case, you might try inclusing LazUtf8 unit in your program (again, in trunk) and report if that fixes the issue.
(0059376)
lingling (reporter)
2012-05-08 03:20

i added the unit lazutf8, but it show : can't find the unit lazutf8


unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,lazutf8;

type

  { TForm1 }

  TForm1 = class(TForm)
    procedure Button1Click(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
 aStr:String;
begin
 aStr:='大家好sde';
 aStr:=StringReplace(aStr,'大家好','你们好',[rfReplaceAll, rfIgnoreCase]);
 showmessage(aStr);
end;

end.
(0059379)
Takeda Matsuki (reporter)
2012-05-08 08:21

StringReplace, works fine with me, here.

I test using, Chinese (traditional), Japanese, Thailand, and Vietnamese.
I'm using Lazarus v1.1 svn 37216.

NOTE :
Please, don't wrote Unicode Characters in SynEdit and use it directly into process. I don't know why, Character (unicode) which came from SynEdit directly, sometime would not working properly to get interaction with us. (See : http://bugs.freepascal.org/view.php?id=21817 [^] )


Regards,
Takeda.
(0059416)
Bart Broersma (developer)
2012-05-08 23:02

> i added the unit lazutf8, but it show : can't find the unit lazutf8

Did you do this in trunk (as I repeatedly asked you) or still 0.9.30.2?
(0060092)
Martin Friebe (manager)
2012-05-31 19:51

@Takeda: about the SynEdit issue.
Please indicate if this can be discussed on the forum, mail-list or private mail ( lazarus # mfriebe.de ). As it is off-topic to this bug.

Have you tried: {$codepage utf8} in the source. maybe the compiler expects the wrong encoding.
Also have you checked the file in an other editor, or edited it outside the IDE and then compiled it?
(0062378)
Bart Broersma (developer)
2012-09-15 13:40
edited on: 2012-09-15 13:40

@lingling: Please test with 1.0
If no feedback is given, this report will be closed.

(0069432)
Bart Broersma (developer)
2013-08-17 13:42

No feedback in a reasonable time.

- Issue History
Date Modified Username Field Change
2012-05-03 13:19 lingling New Issue
2012-05-03 13:19 lingling Widgetset => Win32/Win64, WinCE
2012-05-05 18:01 Bart Broersma File Added: StringReplace.png
2012-05-05 18:02 Bart Broersma File Added: StringReplace.zip
2012-05-05 18:04 Bart Broersma LazTarget => -
2012-05-05 18:04 Bart Broersma Note Added: 0059261
2012-05-05 18:04 Bart Broersma Status new => feedback
2012-05-07 02:51 lingling Note Added: 0059326
2012-05-07 02:52 lingling Note Edited: 0059326
2012-05-07 11:36 Bart Broersma Note Added: 0059348
2012-05-08 03:20 lingling Note Added: 0059376
2012-05-08 08:21 Takeda Matsuki Note Added: 0059379
2012-05-08 23:02 Bart Broersma Note Added: 0059416
2012-05-31 15:23 Bart Broersma Relationship added related to 0022148
2012-05-31 19:51 Martin Friebe Note Added: 0060092
2012-09-15 13:40 Bart Broersma Note Added: 0062378
2012-09-15 13:40 Bart Broersma Note Edited: 0062378
2013-08-17 13:42 Bart Broersma Note Added: 0069432
2013-08-17 13:42 Bart Broersma Status feedback => resolved
2013-08-17 13:42 Bart Broersma Resolution open => unable to reproduce
2013-08-17 13:42 Bart Broersma Assigned To => Bart Broersma



MantisBT 1.2.12[^]
Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker