RE: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-14 Thread Ivan Jouikov
I tried to use table with CHARACTER SET UTF8, but it didn't change anything :(

Any other suggestions?

 -Original Message-
 From: Koon Yue Lam [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 13, 2004 9:50 PM
 To: Tomcat Users List
 Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
 
 http://dev.mysql.com/doc/mysql/en/Charset-defaults.html
 
 in your case, u just define everything as unicode, so just set the
 database encoding to unicode
 
 hopes this help
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-14 Thread Andr Weidemann
Ivan Jouikov wrote:
I tried to use table with CHARACTER SET UTF8, but it didn't change anything :(
Any other suggestions?
I'm using a line like the one below to connect to the MySQL DB and it is 
working quite well here:

DBUrl=jdbc:mysql://+server+:+databaseport+/+database+?user=+login+password=+password+useUnicode=truecharacterEncoding=UTF-8;
You may want to specify characterSetResults as well.
http://dev.mysql.com/doc/connector/j/en/index.html

 Andr.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-14 Thread Ivan Jouikov
I tried using those URL parameters.  Doesn't change anything.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, July 14, 2004 2:30 AM
 To: Tomcat Users List
 Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
 
 Ivan Jouikov wrote:
  I tried to use table with CHARACTER SET UTF8, but it didn't change
 anything :(
 
  Any other suggestions?
 
 I'm using a line like the one below to connect to the MySQL DB and it is
 working quite well here:
 
 DBUrl=jdbc:mysql://+server+:+databaseport+/+database+?user=+login+
 password=+password+useUnicode=truecharacterEncoding=UTF-8;
 
 You may want to specify characterSetResults as well.
 
 http://dev.mysql.com/doc/connector/j/en/index.html
 
 
 
   Andre.
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-14 Thread Mark Matthews
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Ivan Jouikov wrote:
| I tried using those URL parameters.  Doesn't change anything.
|
|
|-Original Message-
|From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
|Sent: Wednesday, July 14, 2004 2:30 AM
|To: Tomcat Users List
|Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
|
|Ivan Jouikov wrote:
|
|I tried to use table with CHARACTER SET UTF8, but it didn't change
|
|anything :(
|
|Any other suggestions?
|
|I'm using a line like the one below to connect to the MySQL DB and it is
|working quite well here:
|
|DBUrl=jdbc:mysql://+server+:+databaseport+/+database+?user=+login+
|password=+password+useUnicode=truecharacterEncoding=UTF-8;
|
|You may want to specify characterSetResults as well.
|
|http://dev.mysql.com/doc/connector/j/en/index.html
Ivan,
You're going to have to do a little testing to see _where_ the character
encoding is being lost.
You should first see if the strings that you are inserting into the
database are the same as being retrieved, either in your JSP, or in a
little testcase (I prefer JUnit myself), by using String's .equals()
method and not your 'eyes'.
The reason to do this is to isolate the different stages of
encoding/decoding from each other, because there's an encoding/decoding
between the JDBC driver and the database, there is one yet again between
your JSP and your browser, and there is many times one yet again between
your browser and your operating system.
You will need to check at _each_ stage to make sure that the characters
are encoded the way you think they are.
I can state from experience that _usually_ it's not at the database
level, however, it's usually a mismatch somewhere else that these
problems occur (but they are hard to debug sometimes :( )
Regards,
-Mark
- --
Mr. Mark Matthews
MySQL AB, Software Development Manager, J2EE and Windows Platforms
Office: +1 708 332 0507
www.mysql.com
MySQL Guide to Lower TCO
http://www.mysql.com/it-resources/white-papers/tco.php
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.3 (MingW32)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFA9U22tvXNTca6JD8RAibYAKDHK+QwHHPXuwK8COGp1XhxRM1s7wCdFmIf
yxc3AlFTMt9LWvRxYdXwMoM=
=6oIc
-END PGP SIGNATURE-
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-14 Thread Koon Yue Lam
Yes, I can't agree with this more
u need to do sdome testing, use JUnit if u can
But I would prefer not only use String.equals, but actually print out
the HEX value of the string
u need to print out the HEX value in:
Just before the JSP form start submit
when the action start process the form
just before any database process
after that, goto Mysql console and print out the HEX value that u just
insert of update

and do the same when u retrieve that value from database

in any case, all the above HEX values should be the same

I know it is ignoring but many people go throught this, sometimes ago
I have the exact problem like this when I use Mysql + PHP + SQL Server
to do database sync.

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-13 Thread Ivan Jouikov










Hey!



Im trying to make it so that
my clients could use different languages when entering stuff into my froms. What I am doing right now is:




 All my pages have %@ page language=java contentType=text/html; charset=UTF-8 at the top
 When I retrieve parameters I use the
 following procedure: 




String text = request.getParameter(text);

 text = new String(text.getBytes(8859_1),UTF8);



This seems to work perfectly for throwing
parameters from page to page. Also, it
seems to work fine to ENTER stuff into MySQL (I look at mysql through GUI
client, and I can see all my Unicode stuff correctly).



However, what is troubling me, is that when I retrieve that Unicode stuff from DB and
try to display it, I get a whole bunch of junk on my page. Heres how I retrieve it:



/**

 * Returns a list
containing GuestBookEntry's ordered by date. 

 * @param page from
which page (page 1: entries 1 thru 5)

 * @return a list
containing GuestBookEntry's ordered by date, empty list if none.

 */

 public static List getEntries(
int page ) throws SQLException

 {

 Connection con = null;

 PreparedStatement st = null;

 ResultSet rs = null;

 List entries = new LinkedList();

 

 if ( page  1 )
throw new IllegalArgumentException(Page must be 1 or above!);

 int startIndex =
(page-1)*offset;

 

 try

 {

 con =
Manager.getInstance().getConnection();

 st =
con.prepareStatement(SELECT name,email,date,IP,message FROM GuestBook
ORDER BY date DESC LIMIT ?,?);

 st.setInt(1,startIndex);

 st.setInt(2,offset);

 rs =
st.executeQuery();

 

 while ( rs.next() )

 {

 String name = rs.getString(1);

 String email = rs.getString(2);

 String IP = rs.getString(4);

 String message = rs.getString(5);

 Timestamp date = rs.getTimestamp(3);

 GuestBookEntry
e = new GuestBookEntry(name,email,IP,message,date);

 entries.add(e);

 }

 }

 finally

 {

 try{ if ( con != null ) con.close(); } catch(SQLException e){ Logger.getLogger(problem).error(Can't
close Connection!,e); }

 }

 

 return entries; 

 }



And in my JSP page I simply display name and message
from the list returned by this function

Does anyone know how to make my JSP page display my
stuff correctly? I also tried doing:



%= new String(message.getBytes(8859_1),UTF8) %



But that
just gives me a whole bunch of boxes instead of text.



Any help is
greatly appreciated.










 
  
  Best Regards,
  
  Ivan V. Jouikov
  (206) 228-6670
  
  
 













---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 

  


Re: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-13 Thread Koon Yue Lam
Hi, I am not en expert, just some piece of advice
I know from MySql 4.01, u can define the character encoding on each
database, table and column. Are u sure your column is encoded in
unicode?

Because the GUI client may smart enought to auto convert the encoding,
so u can view the character properly but becomes boxes when retrieve.

Regards

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-13 Thread Ivan Jouikov
Hmm any idea how to define that?

 -Original Message-
 From: Koon Yue Lam [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, July 13, 2004 9:34 PM
 To: Tomcat Users List
 Subject: Re: Retrieveing Unicode stuff from MySQL 4.1.x ?
 
 Hi, I am not en expert, just some piece of advice
 I know from MySql 4.01, u can define the character encoding on each
 database, table and column. Are u sure your column is encoded in
 unicode?
 
 Because the GUI client may smart enought to auto convert the encoding,
 so u can view the character properly but becomes boxes when retrieve.
 
 Regards
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.716 / Virus Database: 472 - Release Date: 05.07.2004
 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Retrieveing Unicode stuff from MySQL 4.1.x ?

2004-07-13 Thread Koon Yue Lam
http://dev.mysql.com/doc/mysql/en/Charset-defaults.html

in your case, u just define everything as unicode, so just set the
database encoding to unicode

hopes this help

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]