You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by bwasko <bw...@o2.pl> on 2003/11/24 01:45:26 UTC

lame,encoding problem

Hi
I have a strange problem. 
On my jsp pages use utf-8 encoding. Because of problems in my struts application I use the tomcat-example-encoding-filter and set it in web.xml to utf-8 and to processing all requests . It works , tomcat starts normally . When I submit a form i can get the request parameters properly encoded and properly write them with for example System.out.print().
But then when I do something with these parameters and my mysql database I get then them wrong encoded and all data read from mysql are wrong encoded .
What is wrong???
I use MS Windows XP and tomcat 4.1.29
My Locale is pl_PL.
Cheers Bartek Waśko

Re: lame,encoding problem

Posted by Christopher Schultz <ch...@comcast.net>.
David,
> The sun JDK 1.4.2 release mucks encoding up...
> I went back to 1.4.1 and all was fine.

How does JDK 1.4.2 muck up the encoding? I'm using 1.4.2, my 
"file.encoding" appears to be UTF-8, and I have no problem with any of 
the text that I store in my MySQL database.

-chris


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


Re: lame,encoding problem

Posted by David OBrien <do...@naccrra.org>.
The sun JDK 1.4.2 release mucks encoding up...
I went back to 1.4.1 and all was fine.
-Dave



At 07:45 PM 11/23/2003, bwasko wrote:
>Hi
>I have a strange problem.
>On my jsp pages use utf-8 encoding. Because of problems in my struts 
>application I use the tomcat-example-encoding-filter and set it in web.xml 
>to utf-8 and to processing all requests . It works , tomcat starts 
>normally . When I submit a form i can get the request parameters properly 
>encoded and properly write them with for example System.out.print().
>But then when I do something with these parameters and my mysql database I 
>get then them wrong encoded and all data read from mysql are wrong encoded .
>What is wrong???
>I use MS Windows XP and tomcat 4.1.29
>My Locale is pl_PL.
>Cheers Bartek Wa¶ko



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


Re: lame,encoding problem

Posted by bwasko <bw...@o2.pl>.
I ve also tried connection strings manipulations ?use Unicode and
?characterEncoding . Doesn't work.... :(
Bartek Wasko
----- Original Message ----- 
From: "Galbayar" <ga...@mobinet.mn>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, November 24, 2003 10:47 AM
Subject: RE: lame,encoding problem


> jdbc:mysql://127.0.0.1:3306/test/?useUnicode=true
>
> -----Original Message-----
> From: bwasko [mailto:bwasko@o2.pl]
> Sent: Monday, November 24, 2003 4:50 PM
> To: Tomcat Users List
> Subject: Re: lame,encoding problem
>
>
> Hi
> I 've tried to execute insert statement that contains my national
characters
> with the mysql command-line client tool and all looks ok. The strings are
> properly written into database. But writing into it with use of jdbc
driver
> ends with chars like  '??????'. I use mysql-connector and i think it
causes
> these problems.
>
> Cheers Bartek
> ----- Original Message -----
> From: "Christopher Schultz" <ch...@comcast.net>
> To: "Tomcat Users List" <to...@jakarta.apache.org>
> Sent: Monday, November 24, 2003 4:41 AM
> Subject: Re: lame,encoding problem
>
>
> > Bartek,
> >
> > > But then when I do something with these
> > > parameters and my mysql database I get then them wrong encoded and
> > > all data read from mysql are wrong encoded .
> >
> > Hmmm... if you use your Java code to insert some text into the DB, does
> > it look okay when you read it back out using the mysql command-line
> > tool? I'm wondering if the characters are being mangled on the way into
> > of out of the database.
> >
> > See... the UTF-8 encoding only comes into play when converting bytes
> > from the request into Strings on which your Java code operates. Once
> > you're in the Java world, everything should be okay. Again, when you
> > write the data back out to the response, the UTF-8 comes into play as
> well.
> >
> > However, when writing to the db, the strings also need to be converted
> > to bytes by some character encoding. It's very possible that either the
> > VM and/or MySQL are using incompatible character sets. Check to see what
> > the value of the system property "file.encoding" is at runtime.
> >
> > Then again... unless you really are using multibyte characters, you
> > should be okay no matter what. The MySQL JDBC driver should be using the
> > same encoding going both to and from the db. But, if it's an encoding
> > that doesn't understand multibyte characters (like ISO-8859-1), then you
> > might be permanently damaging those characters. Though I use MySQL/Java
> > all the time, I'm not sure how to set the character encoding for the
> > JDBC driver. Check the MySQL documentation, and let us know what you
find.
> >
> > Hope that helps,
> > -chris
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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
>
>



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


RE: lame,encoding problem

Posted by Galbayar <ga...@mobinet.mn>.
jdbc:mysql://127.0.0.1:3306/test?useUnicode=true

-----Original Message-----
From: Galbayar [mailto:galbayar@mobinet.mn]
Sent: Monday, November 24, 2003 5:48 PM
To: Tomcat Users List
Subject: RE: lame,encoding problem


jdbc:mysql://127.0.0.1:3306/test/?useUnicode=true

-----Original Message-----
From: bwasko [mailto:bwasko@o2.pl]
Sent: Monday, November 24, 2003 4:50 PM
To: Tomcat Users List
Subject: Re: lame,encoding problem


Hi
I 've tried to execute insert statement that contains my national characters
with the mysql command-line client tool and all looks ok. The strings are
properly written into database. But writing into it with use of jdbc driver
ends with chars like  '??????'. I use mysql-connector and i think it causes
these problems.

Cheers Bartek
----- Original Message -----
From: "Christopher Schultz" <ch...@comcast.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, November 24, 2003 4:41 AM
Subject: Re: lame,encoding problem


> Bartek,
>
> > But then when I do something with these
> > parameters and my mysql database I get then them wrong encoded and
> > all data read from mysql are wrong encoded .
>
> Hmmm... if you use your Java code to insert some text into the DB, does
> it look okay when you read it back out using the mysql command-line
> tool? I'm wondering if the characters are being mangled on the way into
> of out of the database.
>
> See... the UTF-8 encoding only comes into play when converting bytes
> from the request into Strings on which your Java code operates. Once
> you're in the Java world, everything should be okay. Again, when you
> write the data back out to the response, the UTF-8 comes into play as
well.
>
> However, when writing to the db, the strings also need to be converted
> to bytes by some character encoding. It's very possible that either the
> VM and/or MySQL are using incompatible character sets. Check to see what
> the value of the system property "file.encoding" is at runtime.
>
> Then again... unless you really are using multibyte characters, you
> should be okay no matter what. The MySQL JDBC driver should be using the
> same encoding going both to and from the db. But, if it's an encoding
> that doesn't understand multibyte characters (like ISO-8859-1), then you
> might be permanently damaging those characters. Though I use MySQL/Java
> all the time, I'm not sure how to set the character encoding for the
> JDBC driver. Check the MySQL documentation, and let us know what you find.
>
> Hope that helps,
> -chris
>
>
>
> ---------------------------------------------------------------------
> 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


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


RE: lame,encoding problem

Posted by Galbayar <ga...@mobinet.mn>.
jdbc:mysql://127.0.0.1:3306/test/?useUnicode=true

-----Original Message-----
From: bwasko [mailto:bwasko@o2.pl]
Sent: Monday, November 24, 2003 4:50 PM
To: Tomcat Users List
Subject: Re: lame,encoding problem


Hi
I 've tried to execute insert statement that contains my national characters
with the mysql command-line client tool and all looks ok. The strings are
properly written into database. But writing into it with use of jdbc driver
ends with chars like  '??????'. I use mysql-connector and i think it causes
these problems.

Cheers Bartek
----- Original Message -----
From: "Christopher Schultz" <ch...@comcast.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, November 24, 2003 4:41 AM
Subject: Re: lame,encoding problem


> Bartek,
>
> > But then when I do something with these
> > parameters and my mysql database I get then them wrong encoded and
> > all data read from mysql are wrong encoded .
>
> Hmmm... if you use your Java code to insert some text into the DB, does
> it look okay when you read it back out using the mysql command-line
> tool? I'm wondering if the characters are being mangled on the way into
> of out of the database.
>
> See... the UTF-8 encoding only comes into play when converting bytes
> from the request into Strings on which your Java code operates. Once
> you're in the Java world, everything should be okay. Again, when you
> write the data back out to the response, the UTF-8 comes into play as
well.
>
> However, when writing to the db, the strings also need to be converted
> to bytes by some character encoding. It's very possible that either the
> VM and/or MySQL are using incompatible character sets. Check to see what
> the value of the system property "file.encoding" is at runtime.
>
> Then again... unless you really are using multibyte characters, you
> should be okay no matter what. The MySQL JDBC driver should be using the
> same encoding going both to and from the db. But, if it's an encoding
> that doesn't understand multibyte characters (like ISO-8859-1), then you
> might be permanently damaging those characters. Though I use MySQL/Java
> all the time, I'm not sure how to set the character encoding for the
> JDBC driver. Check the MySQL documentation, and let us know what you find.
>
> Hope that helps,
> -chris
>
>
>
> ---------------------------------------------------------------------
> 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: lame,encoding problem

Posted by bwasko <bw...@o2.pl>.
Hi
I 've tried to execute insert statement that contains my national characters
with the mysql command-line client tool and all looks ok. The strings are
properly written into database. But writing into it with use of jdbc driver
ends with chars like  '??????'. I use mysql-connector and i think it causes
these problems.

Cheers Bartek
----- Original Message ----- 
From: "Christopher Schultz" <ch...@comcast.net>
To: "Tomcat Users List" <to...@jakarta.apache.org>
Sent: Monday, November 24, 2003 4:41 AM
Subject: Re: lame,encoding problem


> Bartek,
>
> > But then when I do something with these
> > parameters and my mysql database I get then them wrong encoded and
> > all data read from mysql are wrong encoded .
>
> Hmmm... if you use your Java code to insert some text into the DB, does
> it look okay when you read it back out using the mysql command-line
> tool? I'm wondering if the characters are being mangled on the way into
> of out of the database.
>
> See... the UTF-8 encoding only comes into play when converting bytes
> from the request into Strings on which your Java code operates. Once
> you're in the Java world, everything should be okay. Again, when you
> write the data back out to the response, the UTF-8 comes into play as
well.
>
> However, when writing to the db, the strings also need to be converted
> to bytes by some character encoding. It's very possible that either the
> VM and/or MySQL are using incompatible character sets. Check to see what
> the value of the system property "file.encoding" is at runtime.
>
> Then again... unless you really are using multibyte characters, you
> should be okay no matter what. The MySQL JDBC driver should be using the
> same encoding going both to and from the db. But, if it's an encoding
> that doesn't understand multibyte characters (like ISO-8859-1), then you
> might be permanently damaging those characters. Though I use MySQL/Java
> all the time, I'm not sure how to set the character encoding for the
> JDBC driver. Check the MySQL documentation, and let us know what you find.
>
> Hope that helps,
> -chris
>
>
>
> ---------------------------------------------------------------------
> 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: lame,encoding problem

Posted by Christopher Schultz <ch...@comcast.net>.
Bartek,

> But then when I do something with these
> parameters and my mysql database I get then them wrong encoded and
> all data read from mysql are wrong encoded .

Hmmm... if you use your Java code to insert some text into the DB, does 
it look okay when you read it back out using the mysql command-line 
tool? I'm wondering if the characters are being mangled on the way into 
of out of the database.

See... the UTF-8 encoding only comes into play when converting bytes 
from the request into Strings on which your Java code operates. Once 
you're in the Java world, everything should be okay. Again, when you 
write the data back out to the response, the UTF-8 comes into play as well.

However, when writing to the db, the strings also need to be converted 
to bytes by some character encoding. It's very possible that either the 
VM and/or MySQL are using incompatible character sets. Check to see what 
the value of the system property "file.encoding" is at runtime.

Then again... unless you really are using multibyte characters, you 
should be okay no matter what. The MySQL JDBC driver should be using the 
same encoding going both to and from the db. But, if it's an encoding 
that doesn't understand multibyte characters (like ISO-8859-1), then you 
might be permanently damaging those characters. Though I use MySQL/Java 
all the time, I'm not sure how to set the character encoding for the 
JDBC driver. Check the MySQL documentation, and let us know what you find.

Hope that helps,
-chris



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


Re: Apache 2, Tomcat 5, and JK2.

Posted by Davide Gurgone <da...@sweetvillage.it>.
Thanks a lot!!!

Davide Gurgone!

> http://jakarta.apache.org/tomcat/faq/
>
> Any where it say tomcat 4.1 (its probbaly the same for 5)
>
> -Tim
>
> John Bell wrote:
> > Hi,
> >
> > Can anyone point me to a how-to please.


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


Re: Apache 2, Tomcat 5, and JK2.

Posted by Tim Funk <fu...@joedog.org>.
http://jakarta.apache.org/tomcat/faq/

Any where it say tomcat 4.1 (its probbaly the same for 5)

-Tim

John Bell wrote:

> Hi,
> 
> Can anyone point me to a how-to please.
>  


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


Re: Apache 2, Tomcat 5, and JK2.

Posted by John Bell <jb...@btclick.com>.
Hi,

Can anyone point me to a how-to please.

Regards,

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