Project JEDI - Issue Tracker
Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002345 [JEDI VCL] 00 JVCL Components minor always 2004-11-28 06:04 2004-11-28 12:53
Reporter anonymous View Status public  
Assigned To user72
Priority normal Resolution fixed  
Status resolved   Product Version 3.00 BETA 2
Summary 0002345: TJvSimpleXML encoded properites
Description SaveToString has sideeffect of decoding element properties.

With TJvSimpleXml.Create(nil) do begin
  LoadFromString('<?xml version="1.0" encoding="iso-8859-1"?><test myprop="Foregin chars:&#xC5;&#xC4;&#xD6;"></test>');
  a:=root.Properties.Value('myprop'); // ÅÄÖ
  tmp:=root.SaveToString;
  b:=root.Properties.Value('myprop'); // &#xC5;&#xC4;&#xD6;
end;
Additional Information
Tags No tags attached.
Attached Files

- Relationships

-  Notes
(0005739)
anonymous (viewer)
2004-11-28 06:09

Sorry, it should be,
SaveToString has sideeffect of encoding element properties.
(0005740)
user72
2004-11-28 06:56

JvSimpleXML only supports UTF-8
(0005742)
anonymous (viewer)
2004-11-28 07:57

With TJvSimpleXml.Create(nil) do begin
  root.Name:='test';
  root.Properties.Add('myProp','Foregin chars:ÅÄÖ');
  a:=root.Properties.Value('myprop');
  tmp:=root.SaveToString;
  b:=root.Properties.Value('myprop');
end;

Same "bug". a<>b.
(0005744)
user72
2004-11-28 11:03

As I said, JvSimpleXML only supports UTF-8 which means that when it saves its data, it is converted to UTF8 and all chars > 127 are converted to hex format.

Try loading the resulting string into Internet Explorer and you'll see that it displays the foregin chars correctly.

We are aware that this could be viewed as a serious limitation, but implementing it any other way would mean a considerable effort.
(0005745)
anonymous (viewer)
2004-11-28 11:57

UTF-8 is not a issue here. You can find the bug at line 2079 and 2085 in JvSimpleXml.pas.

if AEncoder <> nil then
  AEncoder.DoEncodeValue(FValue);
Result := Format(' %s:%s="%s"', [Pointer, Name, FValue]);

DoEncodeValue takes a VAR argument, resulting i FValue to be permantly encoded. To correct the bug you could use something like;

tmp:=FValue;
if AEncoder <> nil then
  AEncoder.DoEncodeValue(tmp);
Result := Format(' %s:%s="%s"', [Pointer, Name, tmp]);

I hope you can find the effort to make this change :-)
(0005746)
user72
2004-11-28 12:53

> I hope you can find the effort to make this change :-)
No need to get cute. If you had explained the problem from the beginning, there wouldn't have been any misunderstanding and the problem resolved immediately.

Fixed in CVS

- Issue History
Date Modified Username Field Change
2004-11-28 06:04 anonymous New Issue
2004-11-28 06:09 anonymous Note Added: 0005739
2004-11-28 06:56 user72 Note Added: 0005740
2004-11-28 07:57 anonymous Note Added: 0005742
2004-11-28 11:03 user72 Note Added: 0005744
2004-11-28 11:04 user72 Status new => feedback
2004-11-28 11:57 anonymous Note Added: 0005745
2004-11-28 12:53 user72 Status feedback => resolved
2004-11-28 12:53 user72 Resolution open => fixed
2004-11-28 12:53 user72 Assigned To => user72
2004-11-28 12:53 user72 Note Added: 0005746


Mantis 1.1.6[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker