Wrong character encoding on extension button labels
Hi,
I install FOP2 in FreePBX Distro FreePBX-1.1005.210.58-i386-Full
and have the problem opposite to the one described in View Post 235/.
I use labels in russian. I convert all the databases and tables in mysql to utf8_general_ci. In mysql tables and FreePBX web panels and in Other > FOP2 Buttons all displayed correctly. The character encoding on queues button label in FOP2 displayed correctly too, but the character encoding on extension button labels is incorrect. This looks like ??????????
I guess that somewhere in the script I need to specify the correct encoding utf-8 when reading data. But where?
I also read the FAQ "...but be sure to save the buttonfile as utf-8. If you fail to do so you might have troubles login in."
I don't have buttons.cfg in /usr/local/fop2. I guess autoconfig performed? What file I need to save as utf-8?
I need any help.
Thanks.
I install FOP2 in FreePBX Distro FreePBX-1.1005.210.58-i386-Full
and have the problem opposite to the one described in View Post 235/.
I use labels in russian. I convert all the databases and tables in mysql to utf8_general_ci. In mysql tables and FreePBX web panels and in Other > FOP2 Buttons all displayed correctly. The character encoding on queues button label in FOP2 displayed correctly too, but the character encoding on extension button labels is incorrect. This looks like ??????????
I guess that somewhere in the script I need to specify the correct encoding utf-8 when reading data. But where?
I also read the FAQ "...but be sure to save the buttonfile as utf-8. If you fail to do so you might have troubles login in."
I don't have buttons.cfg in /usr/local/fop2. I guess autoconfig performed? What file I need to save as utf-8?
I need any help.
Thanks.
Comments
Try to modify autoconfig-buttons-freepbx.sh and add a "SET NAMES UTF8;" before the query to get the button configuration, something like:
This solved the problem. :P It might be worth to add this to a FAQ "Can I use international characters as button labels?"
Best regards
Best regards,
Best regards,
Try to enforce utf8 in your mysql:
Add in /etc/my.cnf
character-set-server=utf8
init-connect='set charset utf8; SET NAMES utf8;'
Then set DB to use UTF8:
ALTER TABLE visual_phonebook DEFAULT CHARSET=utf8;
Thanks for pointing me in the right way.
All the databases and tables in mysql are in utf8. But the output of these сommands shows the following:
mysql> show variables like 'char%';
+
+
+
| Variable_name | Value |
+
+
+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+
+
+
8 rows in set (0.00 sec)
mysql> show variables like '%collation%';
+
+
+
| Variable_name | Value |
+
+
+
| collation_connection | latin1_swedish_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+
+
+
3 rows in set (0.00 sec)
Next I add the following lines to the file /etc/my.cnf:
[mysqld]
init_connect='SET NAMES utf8; SET collation_connection = utf8_general_ci;'
default-character-set=utf8
character-set-server=utf8
collation-server=utf8_general_ci
skip-character-set-client-handshake
[client]
default-character-set=utf8
After execution the сommand /etc/init.d/mysqld restart
the output of the сommands shows the following:
mysql> show variables like 'char%';
+
+
+
| Variable_name | Value |
+
+
+
| 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 | /usr/share/mysql/charsets/ |
+
+
+
8 rows in set (0.00 sec)
mysql> show variables like '%collation%';
+
+
+
| Variable_name | Value |
+
+
+
| collation_connection | utf8_general_ci |
| collation_database | utf8_general_ci |
| collation_server | utf8_general_ci |
+
+
+
3 rows in set (0.00 sec)
Thus the problems with wrong encoding were resolved. The problem is with MySQL FreePBX encoding but not in FOP2.
P.S. I also add the line
charset=utf8
to the /etc/asterisk/cdr_mysql.conf file for correct names encoding in CDR table.
Best regards