Welcome, Guest
Username: Password: Remember me
General discussions, feature requests for CodeTyphon Project and discussions that don't fit in any of the other specific CodeTyphon forum categories.
  • Page:
  • 1

TOPIC:

XMLDocument UTF8 Problem 6 years 9 months ago #10941

  • ct_user
  • ct_user's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 2
  • Thank you received: 0
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

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

Last edit: by ct_user.

XMLDocument UTF8 Problem 6 years 9 months ago #10942

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4518
  • Thank you received: 1102
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... :)
PilotLogic Architect and Core Programmer
The following user(s) said Thank You: ct_user

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

Last edit: by Sternas Stefanos.
  • Page:
  • 1