Forum
× General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.

Question XMLDocument UTF8 Problem

  • ct_user
  • ct_user's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
1 month 3 days ago - 1 month 3 days ago #10941 by ct_user
ct_user created the topic: XMLDocument UTF8 Problem
Hello,
By requesting a xml-result encoded in UTF8,
i found a problem concerning UTF8-Charachters.
in ct6.10 fine.
In ct6.20 char > 255 converted into ?


CT 6.10
function T_DVB_VIEWER2.GET_RS_VERSION: Boolean;
var
i : integer;
RESPONSE : TStringList;
SS : TStringStream;
XML : TXMLDocument;
NODE_ROOT : TDOMNode;
NODE_iver : TDOMNode;
begin
// Get Data
RESPONSE := TStringList.Create;
Self.HttpGetText( Self.F_URL, RESPONSE );
SS := TStringStream.Create( RESPONSE.Text);
SS.Position := 0;
XML := NIL;
ReadXMLFile(xml, SS);
...
END;




SOLUTION for CT 6.20
function T_DVB_VIEWER2.GET_RS_VERSION: Boolean;
var
i : integer;
RESPONSE : TStringList;
SS : TStringStream;
XML : TXMLDocument;
NODE_ROOT : TDOMNode;
NODE_iver : TDOMNode;
begin
// Get Data
RESPONSE := TStringList.Create;
Self.HttpGetText( Self.F_URL, RESPONSE );
SS := TStringStream.Create( RESPONSE.Text, tEncoding.UTF8);
SS.Position := 0;
XML := NIL;
ReadXMLFile(xml, SS);
...
END;



It should be a reason of how a TStringStream is now created without adding tEncoding.UTF8.
prior it works. now you have to extend.


take care
ct_user
Last Edit: 1 month 3 days ago by ct_user.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
1 month 3 days ago - 1 month 3 days ago #10942 by Sternas Stefanos
Sternas Stefanos replied the topic: XMLDocument UTF8 Problem
Sir
thanks for your solution.

It's FPC source improvement
FreePascal SVN 36758 "TStringStream now observes encoding, bug ID 30508"
Info1
Info2
FreePascal bugtracker link

CodeTyphon use the latest FreePascal...
and we track->build->test FPC SVN source 2-5 times per day... :)

CodeTyphon Architect and Programmer
Last Edit: 1 month 3 days ago by Sternas Stefanos.
The following user(s) said Thank You: ct_user

Please Log in or Create an account to join the conversation.