Nance, Michael writes:
 > I am trying to solve a problem we are having with Non-ASCII characters and
 > the Euro.
 > 
 > First I am starting tomcat with -Dfile.encoding=ISO8859-1 in out java
 > startup.
 > 
 > However if I do something like this
 > 
 > Locale localeTest = new Locale("de","de", "Euro");
 > NumberFormat nfTest = NumberFormat.getCurrencyInstance(localeTest);
 > <tr> 
 > <td>Test</td>
 > <td><%=nfTest.format(55555)%></td>
 > </tr>
 > </table>
 > 
 > 
 > I get his result from My Jsp
 > Test 
 > ? 55.555,00
 > I do do a system.out of non Asii Characters  such as é  â ä  à ë è ï - euro
 > symbol (EUR) - British pound £
 > and All print except for the Euro (EUR) but if I echo it to the browser it
 > prints fine.
 > We are on Unix Boxes with Solaris 7
 > 
 > Is there something else I am missing....
 > 

Well for one, there is no Euro in ISO 8859-1.  The major difference
between Latin 1 (8859-1) and Latin 9 (8859-15) aka Latin 0 is that the 
latter has a Euro were the Universal Currency Symbol is in Latin 1 (0xA4).

You mention that the Euro prints fine when you "echo it to the browser".
I'm not sure what that means, but how do you echo it and is the
browser running on a windows box by any chance?  The western encoding
on windows is not exactly Latin anything.  It's CP1252, which is
Latin1, with some extra characters in the second control set from 0x80
to 0x9F.  Guess where they stuck the Euro?  Yep somewhere everyone
else expects a control character (0x80).  No reasonable software
running on Solaris will think that's a Euro, or even printable.  But
if you shove the bits back to a Windows box, you'll see a Euro.

A good rundown of ISO 8859 is at
http://czyborra.com/charsets/iso8859.html

You might try using 8859-15, or perhaps cp1252 if you are only
supporting browsers on windows.  Note you'll need to update the
content type in the page directive of the JSP.  By default it's 8859-1
and all character data is transcoded to that.  In which case I'd
expect you to get '?'s instead of Euros.  Since you're getting the
Currency Symbol from the system, I'd expect you to be getting a proper
UCS2 Euro (\u20ac) in any case -- ie I suspect the default file
encoding doesn't make a difference.  But the encoding of the JSP
output sure will.

Another strategy is to output UTF-8.  Again, the trick is likely to be 
setting the JSP encoding/content-type.

If that doesn't work.  Let me know 
 o what you do see when use the above example
 o what the content type in the page directive is (if any)
 o what environment/locale you are viewing this in (ie where is the
   browser)
 o what the browser thinks it got back (eg what encoding is it trying
   to display, what did it think the content type was.  for netscape
   do View-Page Info.  Not quite sure how to get the content type
   in IE)

-- 
        Drew Sudell     [EMAIL PROTECTED]      http://www.op.net/~asudell

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to