You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Tomáš Páral <tp...@seznam.cz> on 2004/03/04 17:03:35 UTC

problem with encoding

Hi,

   I have problem with showing my data from database. I have stored them in
utf-8, but if I set input.encoding=utf-8 and output.encoding=utf-8 in
velocity.properties, I get
mixture of nonsense characters. I can't change output.encoding from utf-8.

I tried set the URL Connection
.....&amp;useUnicode=true&amp;characterEncoding=utf-8, the presentation
layer was rendered fine, old data were rendered well, but if I put new data
into database, they were rendered bad, because they were not stored in
utf-8.

I use Mysql4, Tomcat5.x, Hibernate and Cator

regards tomas



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


More Powered By

Posted by "Charles N. Harvey III" <ch...@alloy.com>.
Hello all.
I have some sites that we have been working on at Alloy here for a while
that can now be added to the Powered By list.

http://www.carepackages.com
Care Packages
Just what you would think, commerce site for sending
care packages to people (usually college students).

http://www.collegexpress.com
CollegeXpress
Site for high school students to learn about and search
for colleges.  This site has two "sister" sites that
do the same thing but to different audiences and with
different subsets of schools.  Those sites are:

http://www.acuinfo.com
American Colleges and Universities
Site designed for international students interested in
coming to study in the United States.  A profile is written
about each institution for the student's reading enjoyment.

http://www.privatecolleges.com
Private Colleges and Universities
Site designed for students seeking an education at a
private college or university.  A profile is written about
each institution for the student's reading enjoyment.


CarePackages is a fun and easy site to browse.  The three college
sites require a registration to do anything.

Each site uses Velocity 1.3.1 and Velocity Tools 1.0.  Thanks everyone
for all the hard work.  And look for more sites coming out of Alloy in
the future that use Velocity.


Charlie



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


Re: problem with encoding

Posted by Daniel Dekany <dd...@freemail.hu>.
Thursday, March 4, 2004, 5:03:35 PM, "Tomáš Páral" wrote:

> Hi,
>
>    I have problem with showing my data from database. I have stored them in
> utf-8, but if I set input.encoding=utf-8 and output.encoding=utf-8 in
> velocity.properties, I get
> mixture of nonsense characters. I can't change output.encoding from utf-8.
>
> I tried set the URL Connection
> .....&amp;useUnicode=true&amp;characterEncoding=utf-8, the presentation
> layer was rendered fine, old data were rendered well, but if I put new data
> into database, they were rendered bad, because they were not stored in
> utf-8.
>
> I use Mysql4, Tomcat5.x, Hibernate and Cator

This is an issue with the MySQL JDBC driver, and has nothing to do with
Velocity. The data what you get with the java.sql.ResultSet is already
corrupted, so it will remain so when you display it with Vel. I have
found that MySQL+JDBC is pathetically defective regarding encoding
issues...

You may try:

...&amp;useUnicode=true&amp;characterEncoding=utf-8&amp;mysqlEncoding=utf8

Note the mysqlEncoding=... parameter, where I force the *MySQL name* of
the charset. This helped for me with ISO-8859-2 (where it had to be:
mysqlEncoding=latin2). Also, I set the character set of the database
explicitly to ISO-8859-2... maybe you should do that too, just with
utf8. (Database level charset works only in 4.1.1+... otherwise you may
try on server level, with the default-character-set=utf8 in the MySql
ini file... I don't know... MySQL is chaotic about these.)

-- 
Best regards,
 Daniel Dekany



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