View Issue Details

IDProjectCategoryView StatusLast Update
0022441FPCRTLpublic2012-07-17 02:05
Reportersilvioprog Assigned ToMarco van de Voort  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionno change required 
Summary0022441: StringReplace bug (in Delphi it's OK)
DescriptionHi,

I'm trying to replace CR to BR tag, i.e, if the string is 'A'+CRLF+'B'+CRLF+'C', the result will be:

A
LF
B
LF
C

On Delphi it work fine, but on Free Pascal the result is:

A
CRLF
B
CRLF
C
Steps To ReproduceProgram to reproduce the error in attached.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

2012-07-15 19:22

 

stringreplace_bug.zip (4,599 bytes)

silvioprog

2012-07-15 19:29

reporter   ~0061067

To see all characters, I used Notepad++ and I enabled the menu View | Show Symbol | Show all characters.

Please see REAL result here:

http://pastebin.com/4cYt4RWp

ps. Mantis hidden br tag in my issue.

Bart Broersma

2012-07-15 21:45

reporter   ~0061069

There is nothing wrong with StringReplace in this example:

  S2 := StringReplace(S, 0000013, '
', [rfReplaceAll]);
  for i := 1 to length(S2) do write(IntTostr(Ord(S2[i])) + ' ';

Result will be:
65 60 98 114 32 47 62 10 66 60 98 114 32 47 62 10 67

As you can see all Chr(13) are gone from the result.

It's probably the TMemo that handles the LineFeeds different than Delphi.

silvioprog

2012-07-15 22:50

reporter   ~0061070

You're right. I tested with TFileStream instead of TMemo and worked fine.

Thank you Bart! :)

Marco van de Voort

2012-07-16 07:40

manager   ~0061075

Close. Note that lazarus memos are probably utf8

silvioprog

2012-07-17 02:05

reporter   ~0061092

Thank you Bart and Marco. :)

Issue History

Date Modified Username Field Change
2012-07-15 19:22 silvioprog New Issue
2012-07-15 19:22 silvioprog File Added: stringreplace_bug.zip
2012-07-15 19:29 silvioprog Note Added: 0061067
2012-07-15 21:45 Bart Broersma Note Added: 0061069
2012-07-15 22:50 silvioprog Note Added: 0061070
2012-07-16 07:40 Marco van de Voort Status new => resolved
2012-07-16 07:40 Marco van de Voort Resolution open => no change required
2012-07-16 07:40 Marco van de Voort Assigned To => Marco van de Voort
2012-07-16 07:40 Marco van de Voort Note Added: 0061075
2012-07-17 02:05 silvioprog Status resolved => closed
2012-07-17 02:05 silvioprog Note Added: 0061092