XML Javascript Special Chars encoding

D

design4future

Hello newsgroup.

At the moment i am programing an AJAX-Application. This program fetchs
an XML from an perl script via xmlhttprequest.
The xml-content (not the fieldnames) can contain special chars like
german umlauts (äöü), french special chars... or "HTML-Tags"
maybe the content is a html-structure and contains chars like ">".

Now my question:

How can i convert the text in perl to an parseable structure for
Javascript.
Should i use the Javascript function "decodeURI"? But with shich
Perl-Function / Module should I convert the strings then?


At the moment i send an "xml"-header with CGI::header and the first
line of the xml is


<?xml version="1.0" encoding="iso-8859-1"?>


Is that OK?

When I convert all the special chars to their entinities
(HTML::Entities) there is an problem with the "&".
Then there is an parse Error in Javscript and the page leaves blank.



I have also tried to convert the already converted Entities (e.g.
&uuml;) to the "url-mode" (%XXuuml;), but then it is not possible to
convert it back


Is it necessary to include an DTD in this case?
How can i solve the problem?


Thanks for any help or suggestion
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top