View Issue Details

IDProjectCategoryView StatusLast Update
0037605FPCRTLpublic2020-08-27 10:01
ReporterLuis Henrique Assigned ToMichael Van Canneyt  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0037605: Can't disable quoting in TStrings
DescriptionAs stated in http://docwiki.embarcadero.com/Libraries/Tokyo/en/System.Classes.TStrings.QuoteChar setting QuoteChar to null should disable the quote, but it won't work in FPC 3.2.
Steps To ReproduceSet TStrings.QuoteChar to #0 (null)
Check the DelimitedText property, it will be quoted with null bytes instead of no quote at all
Tagsdelphi compatibility, TStrings
Fixed in Revision46530
FPCOldBugId
FPCTarget3.2.2
Attached Files

Activities

Luis Henrique

2020-08-20 18:59

reporter  

strings_quotechar_null.pp (241 bytes)   
program strings_quotechar_null;

uses
  Classes;

var
  List: TStringList;
begin
  List := TStringList.Create;
  List.QuoteChar := #0;
  List.Add('foo bar');
  List.Add('baz');
  Writeln(List.DelimitedText);
  List.Free;
end.
strings_quotechar_null.pp (241 bytes)   

Marco van de Voort

2020-08-20 22:54

manager   ~0125041

Note that FPC solved the same problem by a special property alwaysquote

ravi dion

2020-08-20 23:04

reporter   ~0125042

That's something different Marco. With QuoteChar you can define a char which is used to qoute (", ', ?, #0, 0000013, 0001337, etc)

jamie philbrook

2020-08-21 00:29

reporter   ~0125048

Last edited: 2020-08-21 00:38

View 3 revisions

Using 3.0.4 I would say it's broke and most likely is also this way with 3.2.

If you don't specify "StrictDelimiter" it creates an empty string, maybe full of nulls like Luis stated.

 But if you do specify "StrictDelimiter" it then works but of course it now is accepting the space of the first entry as valid part of the string but does insert a "," in the second item.

So basically with non strict delimiter it should also be inserting a "," to replace the SPACE of the first entry, since that too is a delimiter "<Space>"

Guess I could run that through Delphi to see what happens..

EDIT: Just tried that in Delphi

  I stand correct, it works the same way in either Strict or Non strict..
 the space on the first entry does not get a comma inserted there but it does include the space.
I guess this is logic since a space is a delimiter too so it should build this way and with strict mode it also should be there too of course.

 So I would say generating Blank results is not the desired output.

Michael Van Canneyt

2020-08-21 09:39

administrator   ~0125053

Fixed, thanks for reporting.

Luis Henrique

2020-08-26 15:25

reporter   ~0125132

Shouldn't https://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/rtl/objpas/classes/stringl.inc?view=markup&pathrev=46530#l253 return an empty string if QuoteChar is null?

Michael Van Canneyt

2020-08-27 10:01

administrator   ~0125147

You are right, I missed that. Fixed in 46715.

Issue History

Date Modified Username Field Change
2020-08-20 18:59 Luis Henrique New Issue
2020-08-20 18:59 Luis Henrique File Added: strings_quotechar_null.pp
2020-08-20 19:00 Luis Henrique Tag Attached: delphi compatibility
2020-08-20 19:00 Luis Henrique Tag Attached: TStrings
2020-08-20 22:54 Marco van de Voort Note Added: 0125041
2020-08-20 23:04 ravi dion Note Added: 0125042
2020-08-20 23:20 Michael Van Canneyt Assigned To => Michael Van Canneyt
2020-08-20 23:20 Michael Van Canneyt Status new => assigned
2020-08-21 00:29 jamie philbrook Note Added: 0125048
2020-08-21 00:30 jamie philbrook Note Edited: 0125048 View Revisions
2020-08-21 00:38 jamie philbrook Note Edited: 0125048 View Revisions
2020-08-21 09:39 Michael Van Canneyt Status assigned => resolved
2020-08-21 09:39 Michael Van Canneyt Resolution open => fixed
2020-08-21 09:39 Michael Van Canneyt Fixed in Version => 3.3.1
2020-08-21 09:39 Michael Van Canneyt Fixed in Revision => 46530
2020-08-21 09:39 Michael Van Canneyt FPCTarget => 3.2.2
2020-08-21 09:39 Michael Van Canneyt Note Added: 0125053
2020-08-26 15:25 Luis Henrique Note Added: 0125132
2020-08-27 10:01 Michael Van Canneyt Note Added: 0125147