You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Yair Zohar <ya...@ard.huji.ac.il> on 2005/09/19 08:02:23 UTC

Problems with utf-8 encoding - continue

sorry for the double mail,
I forgot to add my server.xml encoding definitions:

<Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
               port="8080" URIEncoding="UTF-8" useBodyEncodingForURI="true"
           minProcessors="5" maxProcessors="75"
               enableLookups="true" redirectPort="8443"
               acceptCount="100" debug="0" connectionTimeout="20000"
               useURIValidationHack="false" disableUploadTimeout="true"  />

I tried it with and without the useBodyEncodingForURI="true"directive.
Yair.


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


Re: Problems with utf-8 encoding - continue

Posted by Christoph Kutzinski <ku...@gmx.de>.
Jilles van Gurp wrote:
> Oracle on the other hand 
> cannot insert strings larger than 4KB with setString so you need to use 
> setCharacterStream.

FYI:

This is "common knowledge" that used to be right, but isn't anymore.
With the Oracle 10g JDBC driver you can set arbitrary length strings 
with setString

http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/clob10g/handlingclobsinoraclejdbc10g.html


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


Re: Problems with utf-8 encoding - continue

Posted by Yair Zohar <ya...@ard.huji.ac.il>.
Jilles van Gurp wrote:

>
> Why aren't you using setContentType("text/html, "utf-8") on the response?

As I use jsp, I don't know how can I control the response that way.

>
> What content-type is the server actually returning (use the live http 
> headers extension for firefox or something similar to find out).

I couldn't find if this extension is installed, or how to install it.
In the page info :

Type: text/html
Encoding: UTF-8

Meta:
Content-Type text/html; charset=UTF-8

>
> What database and jdbc driver are you using? What method are you using 
> to store the string in the database?

I use mysql 4.1.14 + connector 3.1.10
the url for the driver is: 
"jdbc:mysql://"+Utils.getServerName()+":3306/"+Utils.getDatabaseName()+"?characterEncoding=UTF-8&characterSetResults=UTF-8"

the tables definitions:
ENGINE=MyISAM DEFAULT CHARSET=utf8

>
> I've had utf-8 trouble with several databases. For example mysql 4.1 + 
> the latest jdbc driver + setCharacterStream had some strange effects. 
> First of all you need to tell mysql to use utf-8 (it defaults to 
> something else) and even if you do that setCharacterStream has some 
> issues that go away if you use setString. Oracle on the other hand 
> cannot insert strings larger than 4KB with setString so you need to 
> use setCharacterStream. Incidently, the mysql driver implementation of 
> setCharacterString is implemented using setString!

I use Statement class executeUpdate(String str) method to update and 
executeQuery(String str) to query the database.

>
> Regards,
>
> Jilles
>
> Yair Zohar wrote:
>
>>
>> sorry for the double mail,
>> I forgot to add my server.xml encoding definitions:
>>
>> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
>>               port="8080" URIEncoding="UTF-8" 
>> useBodyEncodingForURI="true"
>>           minProcessors="5" maxProcessors="75"
>>               enableLookups="true" redirectPort="8443"
>>               acceptCount="100" debug="0" connectionTimeout="20000"
>>               useURIValidationHack="false" 
>> disableUploadTimeout="true"  />
>>
>> I tried it with and without the useBodyEncodingForURI="true"directive.
>> Yair.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>


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


Re: Problems with utf-8 encoding - continue

Posted by Jilles van Gurp <in...@jillesvangurp.com>.
Why aren't you using setContentType("text/html, "utf-8") on the response?

What content-type is the server actually returning (use the live http 
headers extension for firefox or something similar to find out).

What database and jdbc driver are you using? What method are you using 
to store the string in the database?

I've had utf-8 trouble with several databases. For example mysql 4.1 + 
the latest jdbc driver + setCharacterStream had some strange effects. 
First of all you need to tell mysql to use utf-8 (it defaults to 
something else) and even if you do that setCharacterStream has some 
issues that go away if you use setString. Oracle on the other hand 
cannot insert strings larger than 4KB with setString so you need to use 
setCharacterStream. Incidently, the mysql driver implementation of 
setCharacterString is implemented using setString!

Regards,

Jilles

Yair Zohar wrote:
>
> sorry for the double mail,
> I forgot to add my server.xml encoding definitions:
>
> <Connector className="org.apache.coyote.tomcat4.CoyoteConnector"
>               port="8080" URIEncoding="UTF-8" 
> useBodyEncodingForURI="true"
>           minProcessors="5" maxProcessors="75"
>               enableLookups="true" redirectPort="8443"
>               acceptCount="100" debug="0" connectionTimeout="20000"
>               useURIValidationHack="false" 
> disableUploadTimeout="true"  />
>
> I tried it with and without the useBodyEncodingForURI="true"directive.
> Yair.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>

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