?
Solved

Build A XMLDocument with Polish characters?

Posted on 2003-11-24
12
Medium Priority
?
418 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
Industry Leaders: 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 750 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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Integration Management Part 2
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

809 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