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
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
  • 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.
Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  


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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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 …
The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
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…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : All lightning effects with instructions : http://www.mediaf…

634 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