tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave O'Donnell <dave.odonn...@entropy.ie>
Subject RE: Tomcat and Java Locale
Date Thu, 16 May 2002 14:15:49 GMT
Hi, 
Happened to be looking at this site today, 
don't know if this is of any help, 
but the full description of the euro char set is 
ISO8859_15_FDIS

http://www.cafeconleche.org/books/xmljava/chapters/ch03s03.html
-----Original Message-----
From: Nance, Michael [mailto:MNance@tickets.com]
Sent: 15 May 2002 23:50
To: 'Tomcat Users List'
Cc: 'asudell@acm.org'
Subject: RE: Tomcat and Java Locale


Drew thanks for the reply.
I tried changing the file encoding to UTF-8 and I still don't get the Euro

Basically I am creating a form like this
</td></tr>
<tr>
<td>
Message: <input type="text" name="msg" size="80" value="special chars é  â ä
à ë è ï - euro symbol (EUR) - British pound £" maxlength="2000">

</td></tr>
<tr><td>

Then when the form is submitted I print it back out to the JSP itself first
with HTML and a system..out.println.
In the HTML all characters print correctln.. in the system.out  The Euro
does not print.

We are running on a Solaris box with Weblogic and Tomat and my Browser is on
a Windows NT machine  (In US, Ca) .  Actualy when I changed to UTF-8 the
characters came out as Chineese characters..  Without the file encoding the
system.outs would come up as all ?'s with it as UTF-8 they are all wrong.

I got this from View Page Info
Form 1:
               Action URL: http://columbus/AmailTest.jsp
               Encoding: application/x-www-form-urlencoded (default)
               Method: Get
          Form 2:
               Action URL: http://columbus/AmailTest.jsp
               Encoding: application/x-www-form-urlencoded (default)
               Method: Get
File MIME Type:
                 text/html
         Source:
                 Currently in disk cache
  Local cache file:
                 M0DB68LH.JSP
   Last Modified:
                 Unknown
   Last Modified:
                 Unknown
  Content Length:
                 17288
         Expires:
                 No date given
         Charset:
                 UTF-8
        Security:
                 This is an insecure document that is not encrypted and
offers no security protection


Thanks again for Replying.. I am really stuck
-----Original Message-----
From: Drew Sudell [mailto:asudell@acm.org]
Sent: Wednesday, May 15, 2002 3:33 PM
To: Tomcat Users List
Subject: Tomcat and Java Locale


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     asudell@acm.org      http://www.op.net/~asudell

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>


Check Point Experience-your information source 
22-24 May-Technical Conference
Citywest Hotel Dublin 
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept
for the presence of computer viruses.


**********************************************************************

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message