XML and special characters ...

A

Alan Searle

For reporting purposes I generate XML from an MS-Access 2002 database
and find that in this way I can format and display the data no problem
with a XSL/HTML template. Perfect!

However, then I found that I needed to replace my automatic MS-Access
output with a customised dump of the XML and find that I am now having a
problem with special characters (umlauts).

For my tests I have built two identical extracts one generated by
MS-Access and the other constructed by me using VBA. Here I find that
my (VBA generated) version produces an error message 'illegal
characters' (stopping at the point where umlauts: ä and ü are found) in
the browser while the MS-Access generated version still displays.

It can't be anthing in the content because both files are identical so I
am wondering whether I need to make any specific declarations when I
open the text file in VBA? Are there any hidden commands which indicate
which characterset the file will contain?

Any tips or links on the issue of handling special characters in XML
would be a great help.

Many thanks,
Alan Searle
 
A

Andreas Prilop

Any tips or links on the issue of handling special characters in XML
would be a great help.

If you write all special, non-ASCII characters as ä or ü
you don't have to worry.
 
P

Peter Flynn

Alan said:
For reporting purposes I generate XML from an MS-Access 2002 database
and find that in this way I can format and display the data no problem
with a XSL/HTML template. Perfect!

However, then I found that I needed to replace my automatic MS-Access
output with a customised dump of the XML and find that I am now having
a problem with special characters (umlauts).

For my tests I have built two identical extracts one generated by
MS-Access and the other constructed by me using VBA. Here I find that
my (VBA generated) version produces an error message 'illegal
characters' (stopping at the point where umlauts: ä and ü are found)
in the browser while the MS-Access generated version still displays.

It can't be anthing in the content because both files are identical so
I am wondering whether I need to make any specific declarations when I
open the text file in VBA? Are there any hidden commands which
indicate which characterset the file will contain?

Any tips or links on the issue of handling special characters in XML
would be a great help.

The default character encoding in XML is UTF-8, so unless one or other
of your sample files specifies something else, your XML processor will
assume UTF-8, and therefore the file that fails must be using some other
encoding. For most western European languages, ISO-8859-1 is sufficient,
so try prefixing the VBA file with an XML Declaration saying so:

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

///Peter
 

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
474,262
Messages
2,571,052
Members
48,769
Latest member
Clifft

Latest Threads

Top