Solved

Build A XMLDocument with Polish characters?

Posted on 2003-11-24
12
408 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
  • 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
 
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now