Friday, January 4, 2019

utf 8 - tomcat/jdbc/mysql: can insert ÿ(U+00FF) but not Ā (U+0100)

my setup:



mysql 5.1



show variables:
| 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 | D:\Programme\MySQL\MySQL Server 5.1\share
charsets\
| collation_connection | utf8_general_ci
| collation_database | utf8_unicode_ci
| collation_server | utf8_general_ci
and even
| init_connect | SET collation_connection = utf8_general_ci; SET NAMES utf8;



the table table has character set utf8



tomcat 6.0



the jdbc connector uses characterEncoding="utf8" useUnicode="true"



now when i try



stmt.execute("UPDATE *table* SET *value*=\"ÿ\" WHERE ...)


it works but for



stmt.execute("UPDATE *table* SET *value*=\"Ā\" WHERE ...)


i get an




java.sql.SQLException: Incorrect string value: '\xC4\x80' for column
'value' at row 1




furthermore it works for all characters below ÿ, which can be encoded with 1 byte but as soon as 2 bytes are needed: bang!



why is that so? and how can i get it to work?

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...