bai1986 opened a new issue #11662:
URL: https://github.com/apache/shardingsphere/issues/11662
The scenario is as follows:
MySQL character set is configured as follows:
character_set_server = gbk
my tables character set is DEFAULT CHARSET=gbk
The ss-proxy version is
apache-shardingsphere-5.0.0-RC1-SNAPSHOT-shardingsphere-proxy-bin
When PHP connects directly to MySQL, Chinese characters are displayed
normally,However, when PHP connects to the ss-proxy and the proxy routes to the
back end, the Chinese code displayed is garbled
For example:
Direct connection mysql,The page is shown below
'product_name' => string '精选汉法词典‘
Connect proxy, and the page is shown as follows
'product_name' => string '绮鹃€夋眽娉曡瘝鍏�'
Therefore, I suspect that some default character set settings of
shardingsphere-proxy affect Chinese garbled code,please give some guidance to
solve this problem
My data source configuration is as follows
config-sharding.yaml
ds_0:
url:
jdbc:mysql://127.0.0.1:3306/ProductDB01?serverTimezone=Asia/Shanghai&useSSL=false&characterEncoding=GBK
I tried to configure GBK, utf8 has no effect on the page display results
Below is some test code
<?php
$cset="GB2312";
header("Content-type:text/html;charset=$cset");
function f_db_connection($host, $username, $passwd, $dbname, $port, $charset
) /*数据库连接*/
{
$connection = new mysqli($host, $username, $passwd, $dbname, $port );
if ($connection->connect_errno) {
printf("db_connection failed: %s \n host=%s ,username=%s, passwd=%s,
dbname=%s \n", $connection->connect_error,$host,$username, $passwd, $dbname);
// printf($port) ;
exit();
}
mysqli_set_charset($connection, $charset);
//mysqli_query($connection, "set names utf8");
return $connection;
}
?>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]