?
Solved

Build A XMLDocument with Polish characters?

Posted on 2003-11-24
12
Medium Priority
?
415 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
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!

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 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