Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / September 2006

Tip: Looking for answers? Try searching our database.

UTF8 Encoding on different machines

Thread view: 
alomrani@gmail.com - 07 Sep 2006 05:53 GMT
Hi All,

I'd really appreciate anyone's insight over here . Since I am trying to
resolve this problem for the past two weeks.

Machine 1: I have a java web application running on Tomcat , MySQL on
one machine with UTF8 encoding showing perfectly on the web client.

Machine 2: I tried to install this application on the server machine
now .. all from fresh like I did on machine 1, installed MySQL, Tomcat
, etc. However, when I run the application the encoding is not properly
displayed. It would show the correct language but the characters are
altered and messy.

I tried on a different machine but still the same . I cant rely on
Machine 1 , and all versions running are the same.

Both machines are win xp pro, MySQL 5.0, java connector 3.2.0 alpha,
Tomcat 5.0.27.

Thanks All
Soren Kuula - 07 Sep 2006 06:07 GMT
> Hi All,
>
> I'd really appreciate anyone's insight over here . Since I am trying to
> resolve this problem for the past two weeks.

> Both machines are win xp pro, MySQL 5.0, java connector 3.2.0 alpha,
> Tomcat 5.0.27.

Hi,

Defaults are evil. They hide in your system, and conspire to ruin your
day. Never trust a default.

So, what are the operating systems on the 2 machines? Can you say
anything about default character encoding on them? ( I think you can
write a small Java program, that gets that from the System class. See
documentation).

On Machine 2, does static content on pages (that never has seen the
database) also go bad, or is it only data from the database?

Either,

- your java listens to the system default encoding somewhere (it never
should; defaults are evil), and it is different in to two machines

or

- the database does the same

or

- both

or

- you use Tomcat through web servers on the two machines, and the web
servers add HTTP headers with encoding (dis)information (try to access
Tomcat directly)

or

- You have migrated database data from server 1 to server 2, and messed
up there.

Søren
alomrani@gmail.com - 07 Sep 2006 08:44 GMT
Thanks Soren for pointing out that.

I did a system parameter check ..
The only difference was in Mysql character set and collation ! eurika..

After running :
show variables like 'character_set%'

Machine 1:
character_set_client         latin1
character_set_connection utf8
character_set_database    utf8
character_set_filesystem binary
character_set_results      latin
character_set_server       utf8
character_set_system    utf8
character_sets_dir          C:\Program Files\MySQL\MySQL Server
5.0\share\charsets\

Machine 2:
character_set_client         utf8
character_set_connection utf8
character_set_database    utf8
character_set_filesystem binary
character_set_results      utf8
character_set_server       utf8
character_set_system    utf8
character_sets_dir          C:\Program Files\MySQL\MySQL Server
5.0\share\charsets\
==============================
BUT :
When I run this it sets it temporarily

set character_set_client='latin1';
set character_set_results='latin1';

And when I try to display the variables again they are still the same (
unchanged )

------------------------------------

You pinpointed also that there could be a problem while migrating the
database. I checked that they are the same !

All collation variables where different now both machines are the same.

I am going crazy now.. not knowing what to do.

I am running windows XP on both machines.

> > Hi All,
> >
[quoted text clipped - 42 lines]
>
> Søren
alomrani@gmail.com - 07 Sep 2006 10:58 GMT
resolved

> Thanks Soren for pointing out that.
>
[quoted text clipped - 92 lines]
> >
> > Søren
Tom Cole - 07 Sep 2006 12:37 GMT
That's it? resolved? What about the poor guy who has the same problem 3
years from now and comes across this thread?

resolved.

That's gonna help him/her out a lot. Glad to see you got something out
of it though.
Soren Kuula - 07 Sep 2006 17:27 GMT
> That's it? resolved? What about the poor guy who has the same problem 3
> years from now and comes across this thread?

Hi,

Yeah, tell us what you did?

In fact I have a MySQL character encoding problem too (too lazy to fight
with it). Tell us what you did with that database please.

Søren


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.