View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002345 | JEDI VCL | 00 JVCL Components | public | 2004-11-28 06:04 | 2004-11-28 12:53 |
Reporter | anonymous | Assigned To | user72 | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.00 BETA 2 | ||||
Target Version | Fixed in Version | 3.00 RC 1 | |||
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:ÅÄÖ"></test>'); a:=root.Properties.Value('myprop'); // ÅÄÖ tmp:=root.SaveToString; b:=root.Properties.Value('myprop'); // ÅÄÖ end; | ||||
Tags | No tags attached. | ||||
|
Sorry, it should be, SaveToString has sideeffect of encoding element properties. |
|
JvSimpleXML only supports UTF-8 |
|
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. |
|
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. |
|
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 :-) |
|
> 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 |
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 |
|
Note Added: 0005740 | |
2004-11-28 07:57 | anonymous | Note Added: 0005742 | |
2004-11-28 11:03 |
|
Note Added: 0005744 | |
2004-11-28 11:04 |
|
Status | new => feedback |
2004-11-28 11:57 | anonymous | Note Added: 0005745 | |
2004-11-28 12:53 |
|
Status | feedback => resolved |
2004-11-28 12:53 |
|
Resolution | open => fixed |
2004-11-28 12:53 |
|
Assigned To | => user72 |
2004-11-28 12:53 |
|
Note Added: 0005746 |