Hi all!
Does anyone know how to set the character encoding for viewing the database in HeidiSQL?
The chars work fine on the website and are stored in a utf8mb4 database via the admin, which works great.
But the moments I do use the editor, I would like to see what's in there, instead of a square or, in this case a 4 byte character, a question mark.
Thanks!
Viewing Unicode characters
Well, I'm using Tahoma (a standard true type font) for displaying them on my website and also in HeidiSQL, and the website. That does the job perfect.
The problem is that HeidiSQL probably can't handle 4 byte characters? 2 byte chars, as you see in the example image are displayed well.
Oh well, not really a problem though, since I use a CMS I build myself which displays them perfectly.
Was just wondering if there is just some way to display them correctly in HeidiSQL.
The problem is that HeidiSQL probably can't handle 4 byte characters? 2 byte chars, as you see in the example image are displayed well.
Oh well, not really a problem though, since I use a CMS I build myself which displays them perfectly.
Was just wondering if there is just some way to display them correctly in HeidiSQL.
That's correct, ansgar, you know what I'm talking about! :D
UTF8mb4 contains 4 byte characters, which UTF8 doesn't support. That's why the other UTF8 characters show as they should, but these ones don't.
I use mysql_query('SET NAMES utf8mb4') to get them properly from the database. And as you said, if HeidiSQL calls it with mysql_set_character_set(FHandle, 'utf8'), they will not appear.
Is that something I can change or is that deeply embedded in HeidiSQL software code?
UTF8mb4 contains 4 byte characters, which UTF8 doesn't support. That's why the other UTF8 characters show as they should, but these ones don't.
I use mysql_query('SET NAMES utf8mb4') to get them properly from the database. And as you said, if HeidiSQL calls it with mysql_set_character_set(FHandle, 'utf8'), they will not appear.
Is that something I can change or is that deeply embedded in HeidiSQL software code?
That utf8 is hardcoded in HeidiSQL. No way to change that from the users point. A workaround could be to create a startup script with "SET NAMES utf8mb4" in it, and apply it to the sessions advanced options. (See tab "Advanced" in the session manager). But I'm afraid that's only one part of the story. Values written to and read from the server are still expected to be encoded in utf8, and so various hardcoded places in HeidiSQL will apply the Delphi method "Utf8ToString" to strings. That's something I cannot give you some workaround for. HeidiSQL should use utf16 or even utf32 in the future, not utf8, I guess.
I could, but the output file is utf-8, so I guess it's not helpful.
But, try this:
CREATE TABLE IF NOT EXISTS `testing_table` (
`index_id` int(11) NOT NULL DEFAULT '0',
`charlist_id` int(11) NOT NULL,
`cOriginal` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`cReplace` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
And insert some of the characters in the cReplace column from the following URL: http://www.fileformat.info/info/unicode/block/mathematical_alphanumeric_symbols/list.htm
And in this case pick some of the chars from MATHEMATICAL FRAKTUR or MATHEMATICAL SCRIPT.
But, try this:
CREATE TABLE IF NOT EXISTS `testing_table` (
`index_id` int(11) NOT NULL DEFAULT '0',
`charlist_id` int(11) NOT NULL,
`cOriginal` varchar(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
`cReplace` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC;
And insert some of the characters in the cReplace column from the following URL: http://www.fileformat.info/info/unicode/block/mathematical_alphanumeric_symbols/list.htm
And in this case pick some of the chars from MATHEMATICAL FRAKTUR or MATHEMATICAL SCRIPT.
I just inserted the "A" character via HeidiSQL's query tab:
But I get chinese chars in the data grid, no matter if I ran "SET NAMES utf8" or "SET NAMES utf8mb4" before.
insert into utable (cReplace) values (_ucs2'\xD835\xDC00')
But I get chinese chars in the data grid, no matter if I ran "SET NAMES utf8" or "SET NAMES utf8mb4" before.
Yeah, don't know about that, when it comes to inserting them directly via the Query tab.
I'm using it via my CMS with a normal query. That's how I got them into the database. The output is fine too.
It's just only the viewing from within HeidiSQL, the character itself is inserted properly in the database.
I'm using it via my CMS with a normal query. That's how I got them into the database. The output is fine too.
It's just only the viewing from within HeidiSQL, the character itself is inserted properly in the database.
Got it working here. Now that I read about utf8 issues here, I would like to switch from utf8 to utf8mb4 in HeidiSQL. However, that requires an update of the libmysql.dll to a newer one which knows the utf8mb4 charset. Seems that utf8mb4 was introduced not so long ago as a fix to the normal utf8 charset?
See my variables and values:
See my variables and values:
I am the develop teamYes, HeidiSQL coding is a one-man-show. There were other developers for short times in the past, but I'd say 99.5% of the code is from me. And of course there are other contributors, for example the myriad of translators, then the Transifex manager, the Facebook writer etc.
Ok, great. Well, you're doing an amazing job, mate!
I used MySQL Front before HeidiSQL, and wasn't satisfied with the utf8 support, it had almost none. Copying tables meant loss of all utf8 characters, even though everything was set to utf8_unicode_ci. That was why I switched to HeidiSQL (and because MySQL Front wasn't updated anymore).
Using HeidiSQL now for 6 months or so and very satisfied, which I expressed with a little donation, since you're doing a great job!
I run about 30 MySQL driven websites, so I'm using HeidiSQL a lot. It's stable, the design is nice, the functions work superb and the utf8 support is great. :D
I used MySQL Front before HeidiSQL, and wasn't satisfied with the utf8 support, it had almost none. Copying tables meant loss of all utf8 characters, even though everything was set to utf8_unicode_ci. That was why I switched to HeidiSQL (and because MySQL Front wasn't updated anymore).
Using HeidiSQL now for 6 months or so and very satisfied, which I expressed with a little donation, since you're doing a great job!
I run about 30 MySQL driven websites, so I'm using HeidiSQL a lot. It's stable, the design is nice, the functions work superb and the utf8 support is great. :D
Code modification/commit
6f6c594
from ansgar.becker,
10 years ago,
revision 8.3.0.4822
Switch character set from utf8 to the fixed one called utf8mb4 in MySQL. Attempt to still use utf8 when that newer charset does not exist in the client library. At the same time, update libmysql to v2.0 from https://downloads.mariadb.org/client-native/2.0.0/ . See http://www.heidisql.com/forum.php?t=16425
Done in r4822. HeidiSQL now tries to use utf8mb4 by default, and if that charset does not exist in libmysql, it uses utf8 as fallback. At the same time I committed a newer libmysql from https://downloads.mariadb.org/client-native/2.0.0/ so the installer contains the utf8mb4 charset. If you just update your HeidiSQL build it will spit out a warning in the sql log about the non existent utf8mb4 charset.
When connecting I see the following in the log:
This doesn't look right because there's no folder "C:\Program Files (x86)" on my system, is it hard coded?
/* Attempt to create plink.exe process, waiting 4s for response ... */
/* Connected. Thread-ID: 310502 */
/* Can't initialize character set utf8mb4 (path: C:\Program Files (x86)\MySql\share\charsets\) */
/* Characterset: utf8 */
This doesn't look right because there's no folder "C:\Program Files (x86)" on my system, is it hard coded?
The message with that faulty path comes from libmysql.dll and you can ignore the fact that it does not use a valid directory.
You should use the nightly build installer in order to get a newer libmysql which has that utf8mb4 charset. When you have the libmysql from the last official 8.3 installer you will always get that error message. Well, HeidiSQL still uses utf8 in that case, so it's not a real problem.
You should use the nightly build installer in order to get a newer libmysql which has that utf8mb4 charset. When you have the libmysql from the last official 8.3 installer you will always get that error message. Well, HeidiSQL still uses utf8 in that case, so it's not a real problem.
Danya: No, you don't need to install anything from MariaDB. Just use the nightly installer: http://www.heidisql.com/installers/HeidiSQL_8.3.0.4822_Setup.exe
Hm, the question marks are now two squares, which is a tad better, but still not like in your sqreenshot.
Might now be one of my own settings.
They display correctly in the webbrowser, so my system supports it. The database standard encoding is utf8 though, the table too. Just the column has utf8mb4, since I just started experimenting with it. But I'm not eager to change the complete database/table encoding (yet) on this domain.
It might work on a clean database, with everything set to mb4.
I'll update you on that tomorrow!
Might now be one of my own settings.
They display correctly in the webbrowser, so my system supports it. The database standard encoding is utf8 though, the table too. Just the column has utf8mb4, since I just started experimenting with it. But I'm not eager to change the complete database/table encoding (yet) on this domain.
It might work on a clean database, with everything set to mb4.
I'll update you on that tomorrow!
The first lines are:
/* Delimiter changed to ; */
/* Connecting to *******.com via MySQL (TCP/IP), username *******, using password: Yes ... */
/* Connected. Thread-ID: 8794864 */
/* Characterset: utf8mb4 */
I'm using MySQL 5.5.37, and it supports the charset since everything is working fine on the frontend.
I did not had the time to test on a fresh domain though and will try ASAP.
By the way, since I updated to r4822 connecting to the server is taking about 10-15 seconds instead of 1 ish second.
/* Delimiter changed to ; */
/* Connecting to *******.com via MySQL (TCP/IP), username *******, using password: Yes ... */
/* Connected. Thread-ID: 8794864 */
/* Characterset: utf8mb4 */
I'm using MySQL 5.5.37, and it supports the charset since everything is working fine on the frontend.
I did not had the time to test on a fresh domain though and will try ASAP.
By the way, since I updated to r4822 connecting to the server is taking about 10-15 seconds instead of 1 ish second.
Ok, so, I created a fresh database on a clean domain, with default collation set to utf8mb4 and created a table with one column, varchar utf8mb4. Still 2 squares.
ALTER DATABASE `in4_db` COLLATE 'utf8mb4_unicode_ci';
CREATE TABLE `test` (
`test` VARCHAR(50) NULL COLLATE 'utf8mb4_unicode_ci'
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=MyISAM;
INSERT INTO `in4_db`.`test` (`test`) VALUES ('
Well I thought I could bump HeidiSQL's feature set by introducing that fixed utf8 charset, so I find that thing quite interesting and important. And I too have this latency on *some* of my connection attempts, mostly not, I'd say in 1 out of 5 sessions I get a 3 second waiter. Weird.
Hm, well, I never experienced the wait time but with the r4822 I do, for every domain and database. Once connected it's all good, but the first connection takes 15 seconds instead of 1.
Hopefully that'll get fixed soon.
If I can do or test anything or supply you with data, let me know.
Hopefully that'll get fixed soon.
If I can do or test anything or supply you with data, let me know.
The delay is directly in the mysql_real_connect method, as I see that when writing to session log files:
Will try a newer libmysql from the current MariaDB GA release.
/* 2014-10-03 14:06:47 [localhost] */ /* Connecting to 127.0.0.1 via MariaDB (TCP/IP), username root, using password: No ... */
/* 2014-10-03 14:06:59 [localhost] */ /* Connected. Thread-ID: 103 */
Will try a newer libmysql from the current MariaDB GA release.
Code modification/commit
e6d0eb2
from ansgar.becker,
10 years ago,
revision 8.3.0.4827
Update libmysql again to those from the MariaDB 10.0.14 package. Probably fixes a connection latency, described in http://www.heidisql.com/forum.php?t=16425
r4827 updates libmysql.dll again to those from the MariaDB 10.0.14 package (current GA release)
And please try again with my exported characters:
And please try again with my exported characters:
CREATE TABLE `utable` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`val` VARCHAR(20) NOT NULL COLLATE 'utf8mb4_unicode_ci',
PRIMARY KEY (`id`)
)
COLLATE='utf8mb4_unicode_ci';
INSERT INTO utable (id, val) VALUES (1, UNHEX('F09D9484'));
INSERT INTO utable (id, val) VALUES (2, UNHEX('F09D9485'));
INSERT INTO utable (id, val) VALUES (3, UNHEX('F09D9487'));
INSERT INTO utable (id, val) VALUES (4, UNHEX('F09D9488'));
INSERT INTO utable (id, val) VALUES (5, UNHEX('F09D9489'));
INSERT INTO utable (id, val) VALUES (6, UNHEX('F09D948A'));
INSERT INTO utable (id, val) VALUES (7, UNHEX('F09D948D'));
INSERT INTO utable (id, val) VALUES (8, UNHEX('F09D948E'));
INSERT INTO utable (id, val) VALUES (9, UNHEX('F09D948F'));
INSERT INTO utable (id, val) VALUES (10, UNHEX('F09D9490'));
Be sure to use the installer from r4827. Another similar delay issue was fixed by the newer libmysql: http://www.heidisql.com/forum.php?t=16547 . And also the connection delay is gone for me here.
And try another font in Preferences > Data appearance, like kalvaro said. Try "Calibri" or the one kalvaro meant.
These hex values should work here, they should work for you too.
And try another font in Preferences > Data appearance, like kalvaro said. Try "Calibri" or the one kalvaro meant.
These hex values should work here, they should work for you too.
Thanks, the installer did the job. It's connecting within a second. Great!!
Did not do anything for the squares though.
Like I said before, changing the font is not gooing to be helping. As long as you use true type fonts, they just work. I'm using Tahoma, which is a truetype font.
But, to prove that, here's a screenshot with Calibri:
Did not do anything for the squares though.
Like I said before, changing the font is not gooing to be helping. As long as you use true type fonts, they just work. I'm using Tahoma, which is a truetype font.
But, to prove that, here's a screenshot with Calibri:
After upgrading to 8.3.0.4839, my Chinese characters become corrupted.
/* Delimiter changed to ; */
/* Connecting to 10.55.99.29 via MySQL (TCP/IP), username root, using password: Yes ... */
/* Connected. Thread-ID: 102 */
/* Can't initialize character set utf8mb4 (path: C:\Program Files (x86)\MySql\share\charsets\) */
/* Characterset: latin1 */
I have tried to install the nightly installer but the problem still exists.
Now I have rolled back to use the stable version 8.3.0.4694.
/* Delimiter changed to ; */
/* Connecting to 10.55.99.29 via MySQL (TCP/IP), username root, using password: Yes ... */
/* Connected. Thread-ID: 165 */
SHOW STATUS;
Thanks.
Now I have rolled back to use the stable version 8.3.0.4694.
/* Delimiter changed to ; */
/* Connecting to 10.55.99.29 via MySQL (TCP/IP), username root, using password: Yes ... */
/* Connected. Thread-ID: 165 */
SHOW STATUS;
Thanks.
I just used the 32 bit installer to try to reproduce your situation, but I get utf8mb4:
What OS is it on your side?
/* Connecting to 127.0.0.1 via MariaDB (TCP/IP), username root, using password: No ... */
/* Connected. Thread-ID: 284 */
/* Characterset: utf8mb4 */
SHOW STATUS;
What OS is it on your side?
MySQL 4.0.23? That's really, *really* old. And utf8mb4 is supported from MySQL 5.5.3 upwards: http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
MySQL 4.0.23? That's really, *really* old. And utf8mb4 is supported from MySQL 5.5.3 upwards: http://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
Would you mind adding an option to let the user choose the default character_set to fallback?
Please login to leave a reply, or register at first.