troubleshooting Question

HOW I CAN SHOW THE UTF-8 character using IXMLDocument component

Avatar of IbrahimSA
IbrahimSA asked on
Delphi
3 Comments1 Solution461 ViewsLast Modified:
hi all

i use the following code for parsing XML .... it works, however, it doesn't show the UTF-8 characters >>>instead it shows '????'


is there any way to show these UTF-8 Characters?

thank a lot
unit Unit1;
 
interface
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Menus, ComCtrls, ExtCtrls,
  XMLDoc, XMLIntf;
 
type
  TForm1 = class(TForm)
    Button3: TButton;
    Memo1: TMemo;
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
    procedure PrintNode(ANode: IXMLNode);
  end;
 
var
  Form1: TForm1;
 
implementation
 
{$R *.dfm}
 
 
procedure TForm1.PrintNode(ANode: IXMLNode);
var cnt: Integer;
begin
  if ANode.NodeType = ntElement then begin
    Memo1.Lines.Add(ANode.NodeName);
    if ANode.IsTextElement then
      Memo1.Lines.Add(#9 + ANode.Text);
    for cnt := 0 to ANode.AttributeNodes.Count - 1 do
      Memo1.Lines.Add(ANode.AttributeNodes.Nodes[cnt].NodeName+'='+ VarToStr(ANode.AttributeNodes.Nodes[cnt].NodeValue));
    for cnt := 0 to ANode.ChildNodes.Count - 1 do
      PrintNode(ANode.ChildNodes.Nodes[cnt]);
  end;
end;
 
procedure TForm1.Button3Click(Sender: TObject);
var doc: IXMLDocument;
    cnt: Integer;
    node: IXMLNode;
begin
  doc := LoadXMLDocument('aa1.xml');
  for cnt := 0 to doc.ChildNodes.Count - 1 do begin
    node := doc.ChildNodes.Nodes[cnt];
    PrintNode(node);
  end;
 
end;
 
end.
ASKER CERTIFIED SOLUTION
db2trade

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros