hallo mark,
> Hopefully the following JUnit testcase helps show that your problem
> doesn't exist at the JDBC level. It creates a UTF-8 connection to
> MySQL-4.1.2, stores UTF-8 encoded strings directly and by prepared
> statements, retrieves them, compares to original as strings, and
> byte-for-byte using the UTF-8 encoding built in to the JVM.
i really appreciate your efforts to help me. many thanks.
nevertheless, i had such a junit-test allready and the only thing
that it proves (imo) is that you can write something into the db
and retrieve it with the same encoding again. this tells nothing
about the transformation of strings from a java app to the jdbc
driver and back or which encoding is used during that transform.
sorry for me being so resistant. but i tried now one additional
client (SqlExplorer for intellij idea) and the result is again
the same. if i execute my insert script via the shell
robertj@sol:> mysql < example_insert.sql or if i execute it with
JFace (which then uses the connector/j jdbc driver) and if i
check then in every single client...every single one displays
the data as expected. if i write the data via my java-app all
clients show garbage.
maybe you understand that i am having a very hard time accepting
that four client apps (SqlExplorer, JFace, mysqlcc, mysql-console)
allways display the data correct if not written by my sample app and
wrong if written by my app.
of course it is possible that the other client-apps are misconfigured.
but than again they must be wrongly configured in the exact same way
as the results are very much the same. you must admit this is quite
inprobable.
> As a further demonstration, here's the results of a select from data
> stored by JDBC in a terminal that obviously doesn't understand UTF-8
> (the DOS command window), which is my guess is your problem with
> mysql-console and mysqlcc, because mysql_console doesn't know anything
> about character sets, it relies on your terminal to display them
> correctly, and mysqlcc doesn't know about utf-8, it only knows about
> that character sets from MySQL-4.0.x and older:
i am very sure that my bash is correctly configured. most of my samples
i copied some text from the unicode site into some file that i saved as
utf-8. i can easily 'more' that file and everything is displayed
correctly (including cyrillic and thai characters).
the only (partial) sollution seems to be to use ResultSet.getBytes
when reading from the db. maybe that is also what JFaceDBC and
SqlExplorer do. nevertheless it does not solve the problem on how
to write to the db without shutting of all other clients.
ciao robertj
Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s