<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Problem with Japanese encoding&#x2F;display]]></title><description><![CDATA[<p dir="auto">I have a MySQL database with lots of Japanese in it. I usually connect to it with PHP and display the data on a web page with a UTF-8 character set, which works fine.</p>
<p dir="auto">When I use PHP MyAdmin to view the database, I see this -  ä½è—¤ã€€ç´€å­ - where I should see this - 佐藤　紀子. When I add and retrieve Japanese text, everything works fine, but that PHP MyAdmin view is odd.</p>
<p dir="auto">My problem here is that I'm retrieving the same data with QT and it's displaying the wrong way. I thought I might simply need to change the encoding of things - maybe the ui file - to UTF-8, but it seems that's the standard encoding in QT Creator.</p>
<p dir="auto">Any idea what I can do here?</p>
<p dir="auto">Thanks a lot.</p>
]]></description><link>https://forum.qt.io/topic/8735/problem-with-japanese-encoding-display</link><generator>RSS for Node</generator><lastBuildDate>Fri, 11 Sep 2026 07:03:29 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/8735.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 19 Aug 2011 04:10:59 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Tue, 13 Sep 2011 14:34:54 GMT]]></title><description><![CDATA[<p dir="auto">OK. I tried that, but it didn't help.</p>
<p dir="auto">Here's the frustrating situation now.</p>
<p dir="auto">I want to use the same database with two different interfaces.</p>
<p dir="auto">Right now, the web interface is in UTF-8. I can input, retrieve and display Japanese charcters this way, but they seem to be stored as nonsense-looking characters.</p>
<p dir="auto">The Qt interface that I'm working on can input, retrieve and display Japanese characters, and they seem to be stored as Japanese characters too, rather than as nonsense-style stuff.</p>
<p dir="auto">Unfortunately, if I use the Qt interface to retrieve data that was inputted with the web interface, it displays as nonsense. If I use the web interface to retrieve data that was stored with the Qt interface, it displays as question marks.</p>
<p dir="auto">The Qt data at least looks correct in the database (viewed with phpMyAdmin). I thought maybe if I could convert all the data to be like that, it would be good, but firstly, I don't know how to do that, and secondly, as I said, when I try to display that data in a browser, it comes out as question marks, so...</p>
<p dir="auto">Any ideas??? [frustrated or confused smilie goes here]</p>
]]></description><link>https://forum.qt.io/post/109023</link><guid isPermaLink="true">https://forum.qt.io/post/109023</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Tue, 13 Sep 2011 14:34:54 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Sat, 10 Sep 2011 14:40:30 GMT]]></title><description><![CDATA[<p dir="auto">Seems like server settings are good, same with my MySql server (I'm using UTF-8 for Russian symbols)</p>
<p dir="auto">Well...<br />
Just for test, right away after connection in your program try execute query:</p>
<p dir="auto">bq. SET CHARACTER SET utf8;</p>
<p dir="auto">and run program.</p>
]]></description><link>https://forum.qt.io/post/108695</link><guid isPermaLink="true">https://forum.qt.io/post/108695</guid><dc:creator><![CDATA[vsorokin]]></dc:creator><pubDate>Sat, 10 Sep 2011 14:40:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Sat, 10 Sep 2011 14:21:53 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the response. Here's what I got:</p>
<p dir="auto">Variable_name  Value<br />
auto_increment_increment  1<br />
auto_increment_offset  1<br />
automatic_sp_privileges  ON<br />
back_log  50<br />
basedir  /<br />
binlog_cache_size  32768<br />
bulk_insert_buffer_size  8388608<br />
character_set_client  utf8<br />
character_set_connection  utf8<br />
character_set_database  latin1<br />
character_set_filesystem  binary<br />
character_set_results  utf8<br />
character_set_server  latin1<br />
character_set_system  utf8<br />
character_sets_dir  /usr/share/mysql/charsets/<br />
collation_connection  utf8_general_ci<br />
collation_database  latin1_swedish_ci<br />
collation_server  latin1_swedish_ci<br />
completion_type  0<br />
concurrent_insert  1<br />
connect_timeout  10<br />
datadir  /var/lib/mysql/<br />
date_format  %Y-%m-%d<br />
datetime_format  %Y-%m-%d %H:%i:%s<br />
default_week_format  0<br />
delay_key_write  ON<br />
delayed_insert_limit  100<br />
delayed_insert_timeout  300<br />
delayed_queue_size  1000<br />
div_precision_increment  4<br />
keep_files_on_create  OFF<br />
engine_condition_pushdown  OFF<br />
expire_logs_days  0<br />
flush  OFF<br />
flush_time  0<br />
ft_boolean_syntax  + -&gt;&lt;()~*:""&amp;|<br />
ft_max_word_len  84<br />
ft_min_word_len  4<br />
ft_query_expansion_limit  20<br />
ft_stopword_file  (built-in)<br />
group_concat_max_len  1024<br />
have_archive  YES<br />
have_bdb  NO<br />
have_blackhole_engine  YES<br />
have_compress  YES<br />
have_community_features  NO<br />
have_profiling  NO<br />
have_crypt  YES<br />
have_csv  YES<br />
have_dynamic_loading  YES<br />
have_example_engine  YES<br />
have_federated_engine  YES<br />
have_geometry  YES<br />
have_innodb  YES<br />
have_isam  NO<br />
have_merge_engine  YES<br />
have_ndbcluster  NO<br />
have_openssl  NO<br />
have_ssl  NO<br />
have_query_cache  YES<br />
have_raid  NO<br />
have_rtree_keys  YES<br />
have_symlink  YES<br />
hostname  <a href="http://biz107.inmotionhosting.com" target="_blank" rel="noopener noreferrer nofollow ugc">biz107.inmotionhosting.com</a><br />
init_connect<br />
init_file<br />
init_slave<br />
innodb_additional_mem_pool_size  1048576<br />
innodb_autoextend_increment  8<br />
innodb_buffer_pool_awe_mem_mb  0<br />
innodb_buffer_pool_size  134217728<br />
innodb_checksums  ON<br />
innodb_commit_concurrency  0<br />
innodb_concurrency_tickets  500<br />
innodb_data_file_path  ibdata1:10M:autoextend<br />
innodb_data_home_dir<br />
innodb_adaptive_hash_index  ON<br />
innodb_doublewrite  ON<br />
innodb_fast_shutdown  1<br />
innodb_file_io_threads  4<br />
innodb_file_per_table  OFF<br />
innodb_flush_log_at_trx_commit  1<br />
innodb_flush_method<br />
innodb_force_recovery  0<br />
innodb_lock_wait_timeout  50<br />
innodb_locks_unsafe_for_binlog  OFF<br />
innodb_log_arch_dir<br />
innodb_log_archive  OFF<br />
innodb_log_buffer_size  1048576<br />
innodb_log_file_size  5242880<br />
innodb_log_files_in_group  2<br />
innodb_log_group_home_dir  ./<br />
innodb_max_dirty_pages_pct  90<br />
innodb_max_purge_lag  0<br />
innodb_mirrored_log_groups  1<br />
innodb_open_files  300<br />
innodb_rollback_on_timeout  OFF<br />
innodb_support_xa  ON<br />
innodb_sync_spin_loops  20<br />
innodb_table_locks  ON<br />
Variable_name  Value<br />
innodb_thread_concurrency  8<br />
innodb_thread_sleep_delay  10000<br />
innodb_use_legacy_cardinality_algorithm  ON<br />
interactive_timeout  30<br />
join_buffer_size  131072<br />
key_buffer_size  805306368<br />
key_cache_age_threshold  300<br />
key_cache_block_size  1024<br />
key_cache_division_limit  100<br />
language  /usr/share/mysql/english/<br />
large_files_support  ON<br />
large_page_size  0<br />
large_pages  OFF<br />
lc_time_names  en_US<br />
license  GPL<br />
local_infile  ON<br />
locked_in_memory  OFF<br />
log  ON<br />
log_bin  OFF<br />
log_bin_trust_function_creators  OFF<br />
log_error<br />
log_queries_not_using_indexes  OFF<br />
log_slave_updates  OFF<br />
log_slow_queries  ON<br />
log_warnings  1<br />
long_query_time  3<br />
low_priority_updates  OFF<br />
lower_case_file_system  OFF<br />
lower_case_table_names  0<br />
max_allowed_packet  5242880<br />
max_binlog_cache_size  18446744073709547520<br />
max_binlog_size  1073741824<br />
max_connect_errors  10<br />
max_connections  500<br />
max_delayed_threads  20<br />
max_error_count  64<br />
max_heap_table_size  16777216<br />
max_insert_delayed_threads  20<br />
max_join_size  18446744073709551615<br />
max_length_for_sort_data  1024<br />
max_prepared_stmt_count  16382<br />
max_relay_log_size  0<br />
max_seeks_for_key  18446744073709551615<br />
max_sort_length  1024<br />
max_sp_recursion_depth  0<br />
max_tmp_tables  32<br />
max_user_connections  30<br />
max_write_lock_count  18446744073709551615<br />
multi_range_count  256<br />
myisam_data_pointer_size  6<br />
myisam_max_sort_file_size  9223372036853727232<br />
myisam_mmap_size  18446744073709551615<br />
myisam_recover_options  OFF<br />
myisam_repair_threads  1<br />
myisam_sort_buffer_size  8388608<br />
myisam_stats_method  nulls_unequal<br />
net_buffer_length  16384<br />
net_read_timeout  30<br />
net_retry_count  10<br />
net_write_timeout  60<br />
new  OFF<br />
old_passwords  OFF<br />
open_files_limit  8702<br />
optimizer_prune_level  1<br />
optimizer_search_depth  62<br />
pid_file  /var/lib/mysql/biz107.inmotionhosting.com.pid<br />
plugin_dir<br />
port  3306<br />
preload_buffer_size  32768<br />
protocol_version  10<br />
query_alloc_block_size  8192<br />
query_cache_limit  1048576<br />
query_cache_min_res_unit  4096<br />
query_cache_size  536870912<br />
query_cache_type  ON<br />
query_cache_wlock_invalidate  OFF<br />
query_prealloc_size  8192<br />
range_alloc_block_size  4096<br />
read_buffer_size  268435456<br />
read_only  OFF<br />
read_rnd_buffer_size  16777216<br />
relay_log<br />
relay_log_index<br />
relay_log_info_file  <a href="http://relay-log.info" target="_blank" rel="noopener noreferrer nofollow ugc">relay-log.info</a><br />
relay_log_purge  ON<br />
relay_log_space_limit  0<br />
rpl_recovery_rank  0<br />
secure_auth  OFF<br />
secure_file_priv<br />
server_id  0<br />
skip_external_locking  ON<br />
skip_networking  OFF<br />
skip_show_database  OFF<br />
slave_compressed_protocol  OFF<br />
slave_load_tmpdir  /tmp/<br />
slave_net_timeout  3600<br />
slave_skip_errors  OFF<br />
slave_transaction_retries  10<br />
slow_launch_time  2<br />
socket  /var/lib/mysql/mysql.sock<br />
Variable_name  Value<br />
sort_buffer_size  268435456<br />
sql_big_selects  ON<br />
sql_mode<br />
sql_notes  ON<br />
sql_warnings  OFF<br />
ssl_ca<br />
ssl_capath<br />
ssl_cert<br />
ssl_cipher<br />
ssl_key<br />
storage_engine  MyISAM<br />
sync_binlog  0<br />
sync_frm  ON<br />
system_time_zone  PDT<br />
table_cache  4096<br />
table_lock_wait_timeout  50<br />
table_type  MyISAM<br />
thread_cache_size  384<br />
thread_stack  262144<br />
time_format  %H:%i:%s<br />
time_zone  SYSTEM<br />
timed_mutexes  OFF<br />
tmp_table_size  33554432<br />
tmpdir  /tmp/<br />
transaction_alloc_block_size  8192<br />
transaction_prealloc_size  4096<br />
tx_isolation  REPEATABLE-READ<br />
updatable_views_with_limit  YES<br />
version  5.0.92-community-log<br />
version_comment  MySQL Community Edition (GPL)<br />
version_compile_machine  x86_64<br />
version_compile_os  unknown-linux-gnu<br />
wait_timeout  30</p>
]]></description><link>https://forum.qt.io/post/108694</link><guid isPermaLink="true">https://forum.qt.io/post/108694</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Sat, 10 Sep 2011 14:21:53 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Sat, 10 Sep 2011 14:06:24 GMT]]></title><description><![CDATA[<p dir="auto">Can you run<br />
SHOW VARIABLES; command on your MySql server and show output?</p>
]]></description><link>https://forum.qt.io/post/108691</link><guid isPermaLink="true">https://forum.qt.io/post/108691</guid><dc:creator><![CDATA[vsorokin]]></dc:creator><pubDate>Sat, 10 Sep 2011 14:06:24 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Sat, 10 Sep 2011 13:45:05 GMT]]></title><description><![CDATA[<p dir="auto">Hi. I'm not really sure what to do anymore but <em>bump</em> this again. Any ideas on this?</p>
]]></description><link>https://forum.qt.io/post/108693</link><guid isPermaLink="true">https://forum.qt.io/post/108693</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Sat, 10 Sep 2011 13:45:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Mon, 29 Aug 2011 05:12:36 GMT]]></title><description><![CDATA[<p dir="auto">Sorry, but... <em>bump</em>.</p>
<p dir="auto">I'm getting nowhere with this encoding issue and still hoping for help.</p>
<p dir="auto">Thanks a lot.</p>
]]></description><link>https://forum.qt.io/post/107252</link><guid isPermaLink="true">https://forum.qt.io/post/107252</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Mon, 29 Aug 2011 05:12:36 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Tue, 23 Aug 2011 00:48:46 GMT]]></title><description><![CDATA[<p dir="auto">Here's a minimal case. (Is this enough?)</p>
<p dir="auto">@<br />
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";</p>
<p dir="auto">/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT <em>/;<br />
/</em>!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS <em>/;<br />
/</em>!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION <em>/;<br />
/</em>!40101 SET NAMES utf8 */;</p>
<p dir="auto">CREATE TABLE IF NOT EXISTS <code>students</code> (<br />
<code>id</code> smallint(3) NOT NULL auto_increment,<br />
<code>sname</code> varchar(30) collate utf8_unicode_ci default NULL,<br />
<code>snamej</code> mediumtext collate utf8_unicode_ci NOT NULL,<br />
<code>email</code> varchar(60) collate utf8_unicode_ci default NULL,<br />
<code>email2</code> varchar(50) collate utf8_unicode_ci NOT NULL,<br />
<code>phone</code> varchar(20) collate utf8_unicode_ci default NULL,<br />
<code>mobile</code> varchar(15) collate utf8_unicode_ci default NULL,<br />
<code>dob</code> date default NULL,<br />
<code>dobY</code> year(4) NOT NULL default '0000',<br />
<code>dobM</code> smallint(2) default NULL,<br />
<code>dobD</code> smallint(2) default NULL,<br />
<code>uclass</code> varchar(20) collate utf8_unicode_ci default NULL,<br />
<code>info</code> longtext collate utf8_unicode_ci,<br />
<code>intro</code> varchar(30) collate utf8_unicode_ci default NULL,<br />
<code>lessons</code> decimal(2,1) NOT NULL,<br />
<code>freect</code> smallint(2) NOT NULL,<br />
<code>level</code> mediumtext collate utf8_unicode_ci NOT NULL,<br />
<code>type</code> varchar(20) collate utf8_unicode_ci default NULL,<br />
<code>uctype</code> varchar(20) collate utf8_unicode_ci default NULL,<br />
<code>old</code> tinytext collate utf8_unicode_ci NOT NULL,<br />
<code>ssdiscount</code> tinytext collate utf8_unicode_ci,<br />
<code>paidforby</code> mediumtext collate utf8_unicode_ci,<br />
<code>paidforby_id</code> int(11) NOT NULL,<br />
<code>paysfor</code> mediumtext collate utf8_unicode_ci NOT NULL,<br />
<code>paysfor_id</code> int(11) NOT NULL,<br />
<code>intschool</code> tinytext collate utf8_unicode_ci,<br />
<code>booked</code> varchar(1) collate utf8_unicode_ci NOT NULL,<br />
<code>startdate</code> varchar(10) collate utf8_unicode_ci NOT NULL,<br />
<code>notcomenotes</code> longtext collate utf8_unicode_ci NOT NULL,<br />
<code>paysfor2</code> varchar(30) collate utf8_unicode_ci NOT NULL,<br />
<code>pass</code> varchar(8) collate utf8_unicode_ci NOT NULL,<br />
<code>onapack</code> tinytext collate utf8_unicode_ci NOT NULL,<br />
<code>joint</code> tinytext collate utf8_unicode_ci NOT NULL,<br />
<code>e1onlist</code> tinyint(1) NOT NULL,<br />
<code>e2onlist</code> tinyint(1) NOT NULL,<br />
<code>address</code> varchar(200) collate utf8_unicode_ci NOT NULL,<br />
PRIMARY KEY  (<code>id</code>)<br />
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1428 ;</p>
<p dir="auto">INSERT INTO <code>students</code> (<code>id</code>, <code>sname</code>, <code>snamej</code>, <code>email</code>, <code>email2</code>, <code>phone</code>, <code>mobile</code>, <code>dob</code>, <code>dobY</code>, <code>dobM</code>, <code>dobD</code>, <code>uclass</code>, <code>info</code>, <code>intro</code>, <code>lessons</code>, <code>freect</code>, <code>level</code>, <code>type</code>, <code>uctype</code>, <code>old</code>, <code>ssdiscount</code>, <code>paidforby</code>, <code>paidforby_id</code>, <code>paysfor</code>, <code>paysfor_id</code>, <code>intschool</code>, <code>booked</code>, <code>startdate</code>, <code>notcomenotes</code>, <code>paysfor2</code>, <code>pass</code>, <code>onapack</code>, <code>joint</code>, <code>e1onlist</code>, <code>e2onlist</code>, <code>address</code>) VALUES<br />
(1007, 'Noriko Sato', 'ä½è—¤ã€€ç´€å­', 'noriko@phonecompany.jp', '', '022-333-9999', '090-2222-0000', '1971-12-10', 1971, 12, 10, '', '', '', '0.0', 0, '', '', 'Korean 50', '', '', '', 0, '', 0, '', 'y', '1226732681', '', '', '26ndjokmh4', '', '', 1, 0, '');</p>
<p dir="auto">@</p>
<p dir="auto">The one character I keep referring to is here: è—¤ (in the 'snamej' field).</p>
]]></description><link>https://forum.qt.io/post/106386</link><guid isPermaLink="true">https://forum.qt.io/post/106386</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Tue, 23 Aug 2011 00:48:46 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Mon, 22 Aug 2011 20:12:45 GMT]]></title><description><![CDATA[<p dir="auto">Could you write up an example with a database dump we can test?</p>
]]></description><link>https://forum.qt.io/post/106368</link><guid isPermaLink="true">https://forum.qt.io/post/106368</guid><dc:creator><![CDATA[Franzk]]></dc:creator><pubDate>Mon, 22 Aug 2011 20:12:45 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Mon, 22 Aug 2011 15:56:43 GMT]]></title><description><![CDATA[<p dir="auto">Thank you both.</p>
<p dir="auto">I put that one character and the strange output into that error-analyzer page and got this:</p>
<p dir="auto">Displaying 4 results<br />
utf-8 (65001, Unicode (UTF-8)) -&gt; Windows-1252 (1252, Western European (Windows))<br />
utf-8 (65001, Unicode (UTF-8)) -&gt; windows-1254 (1254, Turkish (Windows))<br />
utf-8 (65001, Unicode (UTF-8)) -&gt; windows-1256 (1256, Arabic (Windows))<br />
utf-8 (65001, Unicode (UTF-8)) -&gt; windows-1258 (1258, Vietnamese (Windows))</p>
<p dir="auto">I tried this:<br />
@QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));@<br />
but it didn't seem to do anything.</p>
<p dir="auto">The thread Volker pointed me to seemed very promising, but... I tried removing the collation of the MySql database through PHPMyAdmin, but it wouldn't seem to let me. When I changed it to utf8_general_ci (from utf8_unicode_ci) I was able to put the character into the database via my Qt UI and read it in PHPMyAdmin, but when I looked at my webpage (which uses a UTF-8 character set) I just got a question mark.</p>
<p dir="auto">Thanks for any more help. Sorry if this is just getting boring now...</p>
]]></description><link>https://forum.qt.io/post/106336</link><guid isPermaLink="true">https://forum.qt.io/post/106336</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Mon, 22 Aug 2011 15:56:43 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Mon, 22 Aug 2011 12:42:25 GMT]]></title><description><![CDATA[<p dir="auto">Maybe "this older thread":<a href="http://developer.qt.nokia.com/forums/viewthread/7048" target="_blank" rel="noopener noreferrer nofollow ugc">http://developer.qt.nokia.com/forums/viewthread/7048</a> is of help for you.</p>
]]></description><link>https://forum.qt.io/post/106281</link><guid isPermaLink="true">https://forum.qt.io/post/106281</guid><dc:creator><![CDATA[[[global:former-user]]]]></dc:creator><pubDate>Mon, 22 Aug 2011 12:42:25 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Mon, 22 Aug 2011 10:25:31 GMT]]></title><description><![CDATA[<p dir="auto">Try that page's "Character Encoding Errors Analyzer":<a href="http://www.string-functions.com/encodingerror.aspx" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.string-functions.com/encodingerror.aspx</a>.</p>
<p dir="auto">I also think that you should look into "QTextCodec::setCodecForCStrings()":<a href="http://doc.trolltech.com/latest/qtextcodec.html#setCodecForCStrings" target="_blank" rel="noopener noreferrer nofollow ugc">http://doc.trolltech.com/latest/qtextcodec.html#setCodecForCStrings</a>. The results look like latin-1 versions of utf-8 encoded text.</p>
]]></description><link>https://forum.qt.io/post/106268</link><guid isPermaLink="true">https://forum.qt.io/post/106268</guid><dc:creator><![CDATA[Franzk]]></dc:creator><pubDate>Mon, 22 Aug 2011 10:25:31 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Sat, 20 Aug 2011 14:27:39 GMT]]></title><description><![CDATA[<p dir="auto">I've been trying all sorts of things but I haven't found an answer yet.</p>
<p dir="auto">This character - 藤 - is this in unicode - \u85E4.<br />
I put that character into the database through my normal HTML/PHP web page. When  I look at the database stuff in PHPMyAdmin, it looks like this - è—¤. It also looks like that when I call it in the Qt thing I'm building.</p>
<p dir="auto">I did this:   @        QString st = snamej_t.toUtf8().toHex();@<br />
and got this: c3a8e28094c2a4<br />
I put that number into this page here - <a href="http://www.string-functions.com/hex-string.aspx" target="_blank" rel="noopener noreferrer nofollow ugc">http://www.string-functions.com/hex-string.aspx</a> - and got this - Ã¨â€”Â¤.</p>
<p dir="auto">I tried putting the same character (藤) into the database with my Qt interface and directly from the .cpp file. Both times, when I retrieved the data, I got something more strange - something like this - �?��.</p>
<p dir="auto">I was wondering again about Qt Creator and the encoding of the files. I changed the encoding of all files to UTF-8, but when I re-opened tham in Qt Creator, they seemed to have changed back to 'System'. As far as I can work out, the system encoding for this Windows PC I'm using should be unicode, because it's a Japanese OS.</p>
<p dir="auto">I hope you can help me find some kind of answer to this. It's driving me nuts.</p>
<p dir="auto">Thanks a lot.</p>
]]></description><link>https://forum.qt.io/post/106103</link><guid isPermaLink="true">https://forum.qt.io/post/106103</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Sat, 20 Aug 2011 14:27:39 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 07:50:55 GMT]]></title><description><![CDATA[<p dir="auto">Uhm, I would try storing some known characters in the database. Then I would read it out with the above method, using both toString() and toByteArray(). Then see what the actual data is and then try to match it to the unicode table. I'd probably put the same known characters into a QString and see what the contents are:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qstring">@<bdi>QString</bdi></a> str = QString::fromUtf8("whatever\u03c0");@</p>
<p dir="auto">str = whateverπ (That's lower case pi)</p>
]]></description><link>https://forum.qt.io/post/105932</link><guid isPermaLink="true">https://forum.qt.io/post/105932</guid><dc:creator><![CDATA[Franzk]]></dc:creator><pubDate>Fri, 19 Aug 2011 07:50:55 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 07:34:44 GMT]]></title><description><![CDATA[<p dir="auto">Well, I've just searched around to find out how I would do what you suggest, but I'm not finding it, so...<br />
How would I do that?</p>
]]></description><link>https://forum.qt.io/post/105930</link><guid isPermaLink="true">https://forum.qt.io/post/105930</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Fri, 19 Aug 2011 07:34:44 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 07:20:19 GMT]]></title><description><![CDATA[<p dir="auto">Did you output the actual unicode code points (numbers) and compare them with the expected value?</p>
]]></description><link>https://forum.qt.io/post/105924</link><guid isPermaLink="true">https://forum.qt.io/post/105924</guid><dc:creator><![CDATA[Franzk]]></dc:creator><pubDate>Fri, 19 Aug 2011 07:20:19 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 06:58:05 GMT]]></title><description><![CDATA[<p dir="auto">Thanks. That doesn't seem to do it though.</p>
<p dir="auto">Here's what I get from that:   佐�?��??��?子</p>
]]></description><link>https://forum.qt.io/post/105918</link><guid isPermaLink="true">https://forum.qt.io/post/105918</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Fri, 19 Aug 2011 06:58:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 06:52:57 GMT]]></title><description><![CDATA[<p dir="auto">I wouldn't say it's obvious to me. I would expect Qt to handle the encoding bit from the db correctly. To be sure however, I think you could try the following:</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/qstring">@<bdi>QString</bdi></a> theString = QString::fromUtf8(query.value(x).toByteArray());@</p>
<p dir="auto">And see if that yields the desired results.</p>
<p dir="auto">Of course this kind of hard coding will disqualify any possibility of changing encoding in the future (as if you would want to move away from unicode).</p>
]]></description><link>https://forum.qt.io/post/105917</link><guid isPermaLink="true">https://forum.qt.io/post/105917</guid><dc:creator><![CDATA[Franzk]]></dc:creator><pubDate>Fri, 19 Aug 2011 06:52:57 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 06:19:13 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for the reply. Here's the code. The relevant bit is in the query at the bottom. 'snamej' is the bit with the problem.</p>
<p dir="auto">@#include "db.h"<br />
#include "ui_db.h"</p>
<p dir="auto">db::db(QWidget *parent) :<br />
QMainWindow(parent),<br />
ui(new Ui::db)<br />
{<br />
ui-&gt;setupUi(this);<br />
fillStudentDrops();<br />
}</p>
<p dir="auto">db::~db()<br />
{<br />
delete ui;<br />
}</p>
<p dir="auto">void db::on_pushButton_clicked()<br />
{</p>
<p dir="auto">}</p>
<p dir="auto">void db::fillStudentDrops()<br />
{<br />
connect();<br />
QSqlQuery query;<br />
query.exec ("SELECT sname, id FROM students WHERE old='n' || old='' ORDER BY sname ASC");<br />
while  (query.next ())  {<br />
QString sname = query.value (0).toString ();<br />
QVariant id = query.value (1);<br />
qDebug () &lt;&lt; sname &lt;&lt; id;<br />
QString output = sname + " " +id.toString();<br />
ui-&gt;combo1-&gt;addItem(output, id);<br />
}<br />
}</p>
<p dir="auto">void db::connect()<br />
{<br />
QSqlDatabase  cdb = QSqlDatabase::addDatabase ("QMYSQL");<br />
cdb.setHostName ("<a href="http://xxx.xxx.xxx.xxx" target="_blank" rel="noopener noreferrer nofollow ugc">xxx.xxx.xxx.xxx</a>");<br />
cdb.setDatabaseName ("mydatabase");<br />
cdb.setUserName ("myname");<br />
cdb.setPassword ("mypassword");<br />
if (!cdb.open()) qDebug() &lt;&lt; "Failed to connect to root mysql admin";<br />
}</p>
<p dir="auto">void db::on_combo1_currentIndexChanged(int index)<br />
{<br />
QString stu_id = ui-&gt;combo1-&gt;itemData(index).toString();</p>
<p dir="auto">// connect();<br />
QSqlQuery query;</p>
<p dir="auto">// connect();<br />
query.exec ("SELECT sname, id, snamej, email, email2, phone, mobile, dob, info, intro, uctype, ssdiscount, startdate, pass, onapack, joint, address FROM students WHERE id=" + stu_id +"");<br />
while  (query.next ())  {<br />
QString sname_t = query.value(0).toString ();<br />
QVariant id_t = query.value (1);<br />
QString snamej_t = query.value(2).toString ();<br />
QString email_t = query.value(3).toString ();<br />
QString email2_t = query.value(4).toString ();<br />
QString phone_t = query.value(5).toString ();<br />
QString mobile_t = query.value(6).toString ();<br />
QString dob_t = query.value(7).toString ();<br />
QString info_t = query.value(8).toString ();<br />
QString intro_t = query.value(9).toString ();<br />
QString uctype_t = query.value(10).toString ();<br />
QString ssdiscount_t = query.value(11).toString ();<br />
QString startdate_t = query.value(12).toString ();<br />
QString pass_t = query.value(13).toString ();<br />
QString onapack_t = query.value(14).toString ();<br />
QString joint_t = query.value(15).toString ();<br />
QString address_t = query.value(16).toString ();<br />
qDebug () &lt;&lt; sname_t &lt;&lt; id_t &lt;&lt; snamej_t &lt;&lt; email_t &lt;&lt; email2_t &lt;&lt; phone_t &lt;&lt; mobile_t &lt;&lt; dob_t &lt;&lt; info_t &lt;&lt; intro_t &lt;&lt; uctype_t &lt;&lt; ssdiscount_t &lt;&lt; startdate_t &lt;&lt; pass_t &lt;&lt; onapack_t &lt;&lt; joint_t &lt;&lt; address_t;<br />
ui-&gt;email-&gt;setText(email_t);<br />
ui-&gt;phone-&gt;setText(phone_t);<br />
ui-&gt;email2-&gt;setText(email2_t);<br />
ui-&gt;mobile-&gt;setText(mobile_t);<br />
ui-&gt;snamej-&gt;setText(snamej_t);<br />
}<br />
}@</p>
<p dir="auto">Thanks for any help. It might be something obvious to you - I'm just getting started with Qt.</p>
]]></description><link>https://forum.qt.io/post/105912</link><guid isPermaLink="true">https://forum.qt.io/post/105912</guid><dc:creator><![CDATA[BonRouge]]></dc:creator><pubDate>Fri, 19 Aug 2011 06:19:13 GMT</pubDate></item><item><title><![CDATA[Reply to Problem with Japanese encoding&#x2F;display on Fri, 19 Aug 2011 06:02:45 GMT]]></title><description><![CDATA[<p dir="auto">Show us the code. The file encoding of the ui is not important if you get the texts from a database.</p>
]]></description><link>https://forum.qt.io/post/105903</link><guid isPermaLink="true">https://forum.qt.io/post/105903</guid><dc:creator><![CDATA[Franzk]]></dc:creator><pubDate>Fri, 19 Aug 2011 06:02:45 GMT</pubDate></item></channel></rss>