Solved

Build A XMLDocument with Polish characters?

Posted on 2003-11-24
12
411 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending Gmail through Delphi 3 108
Magic Software info 18 131
Delphi inherited method 6 70
how to update exe applicatio from internet ? 6 79
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

810 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