Note that there are some explanatory texts on larger screens.

plurals
  1. POmysql character encoding
    primarykey
    data
    text
    <p>I have a MySQL server with the following settings:</p> <pre><code>character_set_client utf8 character_set_connection utf8 character_set_database utf8 character_set_filesystem binary character_set_results utf8 character_set_server latin1 character_set_system utf8 </code></pre> <p>I have a Java client that connects to this db using DBCP with this config:</p> <pre><code> &lt;bean id="dsJoomla" class="hu.eutrust.wsfresh.CustomDataSource"&gt; &lt;property name="driverClassName" value="${joomla.db.driver}"/&gt; &lt;property name="username" value="${joomla.db.user}"/&gt; &lt;property name="password" value="${joomla.db.pass}"/&gt; &lt;property name="url" value="${joomla.db.url}"/&gt; &lt;property name="connectionProperties" value="characterEncoding=UTF-8;useUnicode=true;"/&gt; &lt;/bean&gt; </code></pre> <p>Then I perform somewhere in the code an update like this:</p> <pre><code>template.update("insert into test (nev) values (:nev)", new MapSqlParameterSource("nev", "Árvíztűrő")); </code></pre> <p>After I check the results in phpMyAdmin I see a row:</p> <pre><code>ID NEV 2 Árvízt?r? </code></pre> <p>The ő and ű characters that are not in the latin1 set are bad. I suppose this is because the character_set_server is latin1. But using phpMyAdmin I can manually edit the record and enter 'Árvíztűrő' and after that the record is correct. So I suppose it is possible to enter the desired value into the database with these settings. How can I do it with my Java client? How shall I configure the connection? Why do my ő and ű chars go wrong if the connection if 100% utf8?</p> <p>show create table test output is:</p> <pre><code>CREATE TABLE `test` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `NEV` varchar(64) NOT NULL, PRIMARY KEY (`ID`) ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 </code></pre> <p>show create database joomla output is:</p> <pre><code>CREATE DATABASE `joomla` /*!40100 DEFAULT CHARACTER SET utf8 */ </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload