Solved

Build A XMLDocument with Polish characters?

Posted on 2003-11-24
12
414 Views
Last Modified: 2010-04-05
How can I  build  a correct XML document with polish characters?

(The input for the polish characters will be from edit boxes).

What encoding should I use to (xmldocument1.encoding)  build an unicode document?
And how do I encode the strings?


0
Comment
Question by:wqclatre
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 6

Expert Comment

by:bpana
ID: 9813216
Hi,

- the TEdit component from Delphi IDE is not unicode, so if you want to use unicode characters try to find some 3rd party components which supports unicode.
- you should use WideString in place of String also for unicode characters.
- for the encoding use UTF-8
- for example I use MS-XML parser when working with XML documents - to use the Microsoft parser go in Project -> Import Type Library and select Microsoft XML, v3.0 or what version you want to use and Create Unit. This will create a file MSXML2_TLB which you should include in your project.

Bogdan
0
 
LVL 2

Author Comment

by:wqclatre
ID: 9817138
Ok. But there must be any way to convert the string from the TEdit to unicode?

I also wounder if I start with a

TXmldocument

and set XMLDocument.encoding to UTF-8

Will it take any strings as they where UTF encoded ? Or do I have to do anyting more?
0
 
LVL 2

Author Comment

by:wqclatre
ID: 9817164
Or should it work if I use a TRichEdit instead?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 6

Expert Comment

by:bpana
ID: 9817375
there is no way to convert the string from TEdit component. you can try to write some polish characters into TEdit and you'll see that they don't appear properly (this is due the fact that the TEdit uses string and not windestring)

about the TXMLDocument there should be fine, but make sure you use Unicode variables.

there is no way to work with the string type from Delphi because it is represented internally on 1 byte, use WideString in place which supports uicode characters (it is represented on 2 bytes)

and also, TRichEdit is not unicode, try to find other component which supports unicode.

Bogdan
0
 
LVL 2

Author Comment

by:wqclatre
ID: 9817410
What do you mean with unicoded variables? Is it Widestring I should use?
0
 
LVL 6

Expert Comment

by:bpana
ID: 9817425
yes
0
 
LVL 2

Author Comment

by:wqclatre
ID: 9817481
One more Question.

Why is polish characters displayed correctly if I load them from a database in to TEdit. or if I save them to a database from a TEdit or TMemo
0
 
LVL 2

Author Comment

by:wqclatre
ID: 9817510
What should I use if I read from a  database?

.AsString ?  (asWideString dont exists)
0
 
LVL 6

Expert Comment

by:bpana
ID: 9817549
what version of delphi do you use? i'm using 6

just if that in delphi 7 they changed the internal format of the string, but i doubt it.

If you use a version less than 7 of Delphi, I don't think you see the proper characters, you see some wird charactes which you think they are good ones ( unless if you know Polish, I can be wrong because I don't)

I tried in a TEdit and TntEdit (unicode) and thy are not the same. the one from TntEdit is the good one.
0
 
LVL 6

Expert Comment

by:bpana
ID: 9817564
you can use the Variant type (and cast it to WideString)
0
 
LVL 2

Author Comment

by:wqclatre
ID: 9817571
Where do I find TnTEdit?


I use Delphi 7. It seems that the polish character works if the Program is running on a Polish installed PC the Polish characters looks ok.
0
 
LVL 6

Accepted Solution

by:
bpana earned 250 total points
ID: 9817602
there is a set of components which support unicode characters:

http://home.ccci.org/wolbrink/tnt/delphi_unicode_controls.htm

0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

690 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question