View Issue Details

IDProjectCategoryView StatusLast Update
0035609FPCRTLpublic2019-05-21 21:46
ReporterDJSAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.0.4Product BuildLazarus 2.0.2 r60954 
Target VersionFixed in Version3.3.1 
Summary0035609: UnicodeStringReplace with Umlauts
DescriptionUnicodeStringReplace relpaces wrong part of a unicodestring if it contains umlauts.
Steps To ReproduceProcedure Test;
Var S, UC, OldP, NewP:UnicodeString;
Begin
  S:='ÜÜÜÖÖÄÄ_%P1%';
  OldP:='%P1%';
  NewP:='1234';
  UC:=UnicodeStringReplace(S, OldP, NewP, []);
  ShowMessage(UTF8Encode(UC));
end;

Result is "ÜÜÜÖÖÄÄ_%P1%1234" instead of "ÜÜÜÖÖÄÄ_1234".
Additional InformationIn the source code of UnicodeStringReplace, AnsiPos is used, which returns wrong a string position.

Using ReplaceString instead of UnicodeStringReplace seems to work.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget3.2.0
Attached Files

Activities

nanobit

2019-05-21 20:17

reporter   ~0116309

FPC 3.2 has improved version which works.

Michael Van Canneyt

2019-05-21 21:46

administrator   ~0116311

This works in 3.3.1 (and should be in 3.2)

Procedure Test;
Var
  S, UC, OldP, NewP : UnicodeString;
Begin
  S:=Utf8Decode('ÜÜÜÖÖÄÄ_%P1%');
  OldP:='%P1%';
  NewP:='1234';
  UC:=UnicodeStringReplace(S, OldP, NewP, []);
  Writeln(UTF8Encode(UC));
end;

Issue History

Date Modified Username Field Change
2019-05-21 19:42 DJS New Issue
2019-05-21 20:17 nanobit Note Added: 0116309
2019-05-21 21:46 Michael Van Canneyt Assigned To => Michael Van Canneyt
2019-05-21 21:46 Michael Van Canneyt Status new => resolved
2019-05-21 21:46 Michael Van Canneyt Resolution open => fixed
2019-05-21 21:46 Michael Van Canneyt Fixed in Version => 3.3.1
2019-05-21 21:46 Michael Van Canneyt FPCTarget => 3.2.0
2019-05-21 21:46 Michael Van Canneyt Note Added: 0116311