Daniil --

We're doing all the same stuff and haven't encountered any problems. Here's a 
few tidbits from our configuration.


In our mySQL connector we use:
  <Resource name="jdbc/xxx" auth="Container" type="javax.sql.DataSource"
    
url="jdbc:mysql://localhost/xxxxx?autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;jdbcCompliantTruncation=false"
 
    username="xxx"
    password="xxx" driverClassName="com.mysql.jdbc.Driver" maxActive="20"
    maxIdle="20" maxWait="10000" defaultAutoCommit="true" 
    validationQuery="SELECT 1"
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory" />



In the tomcat container new add:

nano $CATALINA_HOME/conf/server.xml:
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1" URIEncoding="UTF-8"
connectionTimeout="20000"

Cheers -
Phil


On Feb 4, 2011, at 12:45 PM, Daniil Sosonkin wrote:

> Hi there,
> 
> So I'm sure there's someone out there who has met this problem and has found 
> a solution, therefore, let me ask the source. We are dealing with an 
> international web platform - many many languages. People submit forms in 
> different languages and it all stored in a mySQL database. Basically, I'm 
> having troubles getting UTF8 to work with said database. I have troubles at 
> all levels - stripes and database.
> 
> Here's my set up:
>    - mySQL 5.1
>    - mysql-jdbc 5.1 (driver)
>    - tables - utf8
>    - LocalePicker is always forcing charset to UTF-8 in stripes
> 
> Here's the problem:
>    - User enters some characters into the form (chinese, russian, hebrew....)
>    - ActionBean sticks it into the database and sends email.
>    - Fields are declared as Strings and nothing is done to the values
>    - When sticking to the database it will contain - ???? as values
>    - The output from the database obviously doesn't work
>    - When printing submitted value on page from ${actionBean.field} it 
> displays junk
> 
> I know that browsers send all forms to the servers in ISO-8859-1 encoding. In 
> the good old days, or with plain servlets, I would always have to convert 
> submitted values to UTF-8 with the following: new 
> String(rs.getString(1).getBytes("ISO-8859-1"), "UTF-8"); From then on the 
> value is in UTF-8
> 
> In Stripes, I think that the values come to ActionBeans in ISO-8859-1 since 
> StringTypeConverter doesn't do anything. That's fine, I wrote my own 
> converter for UTF using the logic from above. This solves the problem with 
> printing submitted value on the page ${actionBean.field}; but if the value is 
> still displayed in the form it is all grumbled as if it was ISO-8859-1 
> representation of UTF-8. That I don't understand.
> 
> As for storing UTF8 into mySQL - well, if someone can help me out it would be 
> great since I can't get UTF8 string stored in the database without doing the 
> UTF8 to ISO-8859-1 and back conversion while keeping tables at latin1 I would 
> really appreciate it. The main question is Stripes.
> 
> I hope this whole rambling makes sense and someone has had this problem 
> previously. Hopefully there was a solution.
> 
> Sincerely,
> Daniil
> <daniil.vcf>------------------------------------------------------------------------------
> The modern datacenter depends on network connectivity to access resources
> and provide services. The best practices for maximizing a physical server's
> connectivity to a physical network are well understood - see how these
> rules translate into the virtual world? 
> http://p.sf.net/sfu/oracle-sfdevnlfb_______________________________________________
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users

------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to