Euro Sign using XML, VB, Java

Posted on 2002-05-20
Last Modified: 2012-06-22
I am using a VB client to pass data to a java servlet which processes the data (passed using MSXML3 on the client to Xerces-1_4_3 on the server) and writes it to an oracle database.  The problem I am having is with the euro symbol (€).   I convert it from € to € using Replace method in VB and then I pass this XML (UTF-16) to the server which is telling me the document is mal formed - Org.sax.parser exception.

I presume that Xerces supports the Euro symbol so I am kinda stuck.

Question by:adamgernon
  • 3
  • 2
  • 2
  • +1
LVL 23

Expert Comment

ID: 7021980
The thing is that MSXML3 supports the windows-1252 encoding for which the Euro symbol is supported. I think on principle, you should not worry about the euro symbol per se as it has more to do with the presentation layer than the data layer. You can use namespaces to determine the datatype if you want to get down to partitioning the data. Do not use the symbol to figure out what kind of currency. That is more reserved for display purposes.

for e.g.
<?xml version="1.0" encoding="utf-8"?>
<price xmlns="uri:euro">1.35</price>
<price xmlns="uri:us">2.00</price>
<price xmlns="uri:uk">1.05</price>
LVL 23

Expert Comment

ID: 7021988
in fact, by using namespaces here, it is pretty useful if you are using XSLT to display the data because you can sum prices for objects based on the namespace. in fact, using namespaces here is an excellent choice =))

Expert Comment

ID: 7022086
What's the exact error you get from Xerces? Maybe the Euro symbol is not the problem.
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.


Author Comment

ID: 7022094
It is definitely the Euro symbol that is causing the problem because when u enter in ascii text and call the server method using POST it succeeds fine however, if I just enter the symbol € it collapses.

Accepted Solution

yoren earned 100 total points
ID: 7022136
The Euro symbol is a valid XML character, and I verified that Xerces 1.4.4 handles it correctly. So, either it's a bug in version 1.4.3 (unlikely), or your document is not well-formed. Are you sure your document is encoded in UTF-16? If it is, are you properly declaring that with <?xml version='1.0' encoding='UTF-16'?> ?

You can probably debug this easier on the command line. Another option is to post your document here; I may be able to spot the problem.
LVL 27

Expert Comment

ID: 7024514
Interestingly enough you have posted your message using hex 80 as the Euro symbol, yet you wish to use 8364 = hex 20AC which of course is the offical Unicode sign.

There are two cases :-

a) The insertion/substitution of the sign with the entity is incorrect so that the parser reports an error

b) hex 20AC is not a valid character since the parser supports only Unicode versio 2.0 (the 20AC came later).

I suspect a) is true. Try subsituting &#36; (which is dollar) instead just to check that you get the entity substitution correct. If that works try using &#128;

Author Comment

ID: 7043928
I have figured out that the problem is that on the client we are encoding using UTF-16 but on the Java Server where we are using Xerces DOM implementation I cannot manage to get the encoding to UTF-16. See my other question posted 05/28/2002.  Anyway, let me know if u can solve this little conundrum.

Author Comment

ID: 10152406
request for deletion of queston been here for over a year!!!

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: (…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now