Answer the question
In order to leave comments, you need to log in
Why are question marks displayed instead of Russian letters, data from mysql via odbc?
The situation is as follows, in the dialplan I want to display data in Russian from the mysql database via odbc.
Asterisk 1.8.12.2 on debian 6, mysql 5.5.35-0+wheezy1 encoding UTF-8 Unicode (utf8). The database from which I pull the data comparison with utf8_general_ci, the table has a similar encoding. Debian also has utf8 installed.
There are no problems with the settings:
/etc/odbc.ini:
[asterisk-connector]
Driver = MySQL
Description = Connector/ODBC 3.51 Driver DSN
Server = localhost
Port = 3306
User = asterisk
Password = ********
Database = asterisk
Socket = /var/run/mysqld/mysqld.sock
[asterisk]
enabled = yes
dsn = asterisk-connector
username = asterisk
password = *******
pooling = no
limit = 1
pre-connect = yes
[NAME]
dsn=asterisk
readsql=select name from destinations where prefix in (substr('${CALLERID(num)}',2,7),substr('${CALLERID(num)}',2,6),substr('${CALLERID(num)}',2,5),substr('${CALLERID(num)}',2,4),substr('${CALLERID(num)}',2,3)) order by length(prefix) DESC limit 1
exten => 84959898533,1,Set(CALLERID(name)=${ODBC_CODE()})
mysqli_query($db_ad, "SET NAMES 'utf8' COLLATE 'utf8_general_ci'");
mysqli_query($db_ad, "SET CHARACTER SET 'utf8'");
[mysqld]
init-connect="SET NAMES utf8"
character-set-server=utf8
collation-server=utf8_general_ci
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/ |
+--------------------------+----------------------------+
[email protected]:~# locale
LANG=ru_RU.UTF-8
LANGUAGE=
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=
en_US.UTF-8 UTF-8
ru_RU.UTF-8 UTF-8
exten => _7XXXXXXXXXX,n,Set(CALLERID(name)=${ODBC_NAME()})
exten => _7XXXXXXXXXX,n,jabbersend(asterisk,******@jabber.ru, Звонок от ${CALLERID(name)})
Executing [7**********@incoming-youmagic:7] Set("SIP/youmagic-00000004", "CALLERID(name)=??? 6422") in new stack
-- Executing [7*********@incoming-youmagic:8] JabberSend("SIP/youmagic-00000004", "asterisk,*****@jabber.ru, Звонок от ??? 6422 с номера <+7*********> в 15:08:39 2014-07-13 ") in new stack
Answer the question
In order to leave comments, you need to log in
and what for there odbts?
upd:
lists.digium.com/pipermail/asterisk-users/2012-Dec...
/etc/odbc.ini
[MySQL-asterisk]
Description = MySQL ODBC Driver
Driver = MySQL
Socket = /var/run/mysqld/mysqld.sock
Server = localhost
User = my_username
Password = my_password
Database = my_database
Option = 3
Port =
Charset = utf8
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question