tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Radvan <James.Rad...@argos.co.uk>
Subject RE: foriegn characters turn to ? in database
Date Thu, 12 Jul 2001 10:23:08 GMT
Out of interest, will using "charset=UTF-8" work? (unicode)

James

---------------------------------
James Radvan
Websphere Analyst/Architect
London, UK
james@imperiumglobal.com
+44 7990 624899


-----Original Message-----
From: Tõnu Põld [mailto:Tonu.Poeld@andmevara.ee]
Sent: 12 July 2001 08:32
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: foriegn characters turn to ? in database


Hi,

There are several places where this "?" conversion might happen.

a) If your JSP page output should be in Latin2, then you must have the <%@
page contentType = "text/html; charset=ISO-8859-2" %> directive in JSP page.
Else the default encoding (iso-8859-1) is used and the strings are converted
from Latin2 to Latin1. Because some Latin2 charcters are missing in Latin1,
those characters are dispayed as question marks.

b) If your database uses Latin2, then the JDBC draiver might not convert the
charcters to correct java unicode charcters. This may happen because the
JDBC draiver thinks your database uses Latin1 encoding. Make sure the JDBC
draiver supports Latin2. This could be tested by getting some Java String
from database and by comparing the numeric character code with the character
code in unicode table (http://www.unicode.org/charts/). For finding the
numeric character code use: 
char c = dbString.charAt(0);

If the JDBC draiver supports only Latin1, then the strings could be
convereted to Latin2 by using something like this:
String s = new String( dbString.getBytes("ISO-8859-1"), "ISO-8859-2");

On most cases the "?" conversion happens when the Java character (16 bit
unicode char) is converted 8-bit character. Please look some Java
tutorial/manual to learn more about the Java Characters/Strings.

Best Regards,
Tõnu

> -----Original Message-----
> From: gregor.kovac@mikropis.si [mailto:gregor.kovac@mikropis.si]
> Sent: Thursday, July 12, 2001 7:47 AM
> To: tomcat-user@jakarta.apache.org
> Subject: Re: foriegn characters turn to ? in database
> 
> 
> Hi!
> 
> I have seen this behavior too.
> I'm using MYSQL 3.23.36 with Latin2 character set as default. 
> I can see 
> these foreign characters in the database, but they are 
> converted to ? on 
> the JSP output. Sometimes also the foreign characters that 
> are in the JSP 
> itself get converted to ?.
> 
> Any idea?
> 
> Best regards,
>          Kovi
> 
> P.S.: Using WinNT 4 Service Pack 6, Tomcat 3.3m4
> 
> At 22:27 11.7.01 +0000, you wrote:
> 
> >Bryan, does your database use foreign character sets?
> >
> > >From: "Bryan Murtha"
> > >Reply-To: tomcat-user@jakarta.apache.org
> > >To: tomcat-user@jakarta.apache.org
> > >Subject: foriegn characters turn to ? in database
> > >Date: Wed, 11 Jul 2001 20:58:53
> > >
> > >Hey All,
> > >
> > >
> > > We are accepting form submissions from users all over the world.
> > >The foriegn characters end up in Sybase looking like a ?. Does
> > >someone
> > >know how to deal with this?
> > >
> > >Regards,
> > >Bryan
> > >
> > >
> > >----Original Message Follows----
> > >From: Stefanos Karasavvidis
> > >Reply-To: tomcat-user@jakarta.apache.org
> > >To: tomcat-user@jakarta.apache.org
> > >Subject: getServletContext() throws NullPoinetException
> > >Date: Tue, 10 Jul 2001 17:46:04 +0300
> > >
> > >I've just installed tomcat 3.2.2 and have the following problem.
> > >
> > >I want to call getServletContext() from a servlets service method
> > >but
> > >get the folowing exception
> > >*Internal Servlet Error:*
> > >
> > >java.lang.NullPointerException
> > > at
> > 
> >javax.servlet.GenericServlet.getServletContext(GenericServlet
.java:205)
> > > at TestServlet.service(TestServlet.java:32)
> > > at
> > 
> >org.apache.tomcat.core.ServletWrapper.doService(ServletWrappe
r.java:405)
> > > at org.apache.tomcat.core.Handler.service(Handler.java:287)
> > > at
> > 
> >org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.
java:372)
> > > at
> > 
> >org.apache.tomcat.core.ContextManager.internalService(Context
Manager.java 
> > :797)
> > > at
> > 
> >org.apache.tomcat.core.ContextManager.service(ContextManager.
> java:743)
> > > at
> > 
> >org.apache.tomcat.service.connector.Ajp12ConnectionHandler.pr
> ocessConnect 
> > ion(Ajp12ConnectionHandler.java:166)
> > > at
> > 
> >org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoi
nt.java:416)
> > > at
> > 
> >org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadP
ool.java:501)
> > > at java.lang.Thread.run(Thread.java:484)
> > >
> > >
> > >Moreover the getServletConfig() returns null which is probably the
> > >main
> > >reason for this problem
> > >
> > >Any ideas??
> > >
> > >Stefanos
> > >
> > >
> > >
> > >_________________________________________________________________
> > >Get your FREE download of MSN Explorer at http://explorer.msn.com
> > >
> >
> >
> >----------
> >Get your FREE download of MSN Explorer at 
> ><http://explorer.msn.com>http://explorer.msn.com
> 


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

Click here to visit the Argos home page http://www.argos.co.uk

The information contained in this message or any of its attachments may be privileged and
confidential, and is intended exclusively for the addressee.
The views expressed may not be official policy, but the personal views of the originator.
 
If you are not the addressee, any disclosure, reproduction, distribution, dissemination or
use of this communication is not authorised.
If you have received this message in error, please advise the sender by using the reply facility
in your e-mail software.
All messages sent and received by Argos Ltd are monitored for virus, high risk file extensions,
and inappropriate content.  As a result users should be aware that mail may be accessed.

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

Mime
View raw message