apache / apache/shardingsphere

ShardingSphere-Proxy supports setting character encoding?

Open
#23,006 2 comments 0 reactions 0 assignees View on GitHub
in: proxy type: enhancement
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

In some case, I want to set character-set when connect to shardingsphere-proxy by mysql client like the following command

```sql
mysql -h -P -u xxx -p --default-character-set=gbk
```
but shardingsphere-proxy not support this.

```
mysql> show variables like 'character%';
+--------------------------+-----------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.7.30-macos10.14-x86_64/share/charsets/ |
+--------------------------+-----------------------------------------------------------+
8 rows in set (0.04 sec)

```

I use same command connect to mysql, it is work.
```
mysql -hlocalhost -P3306 -uroot -p --default-character-set=gbk
Enter password:

mysql> show variables like 'character%';
+--------------------------+-----------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-----------------------------------------------------------+
| character_set_client | gbk |
| character_set_connection | gbk |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | gbk |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.7.30-macos10.14-x86_64/share/charsets/ |
+--------------------------+-----------------------------------------------------------+
8 rows in set (0.00 sec)

```

I think we can enhance this feature.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported connection with the MySQL client using --default-character-set=gbk, then compare SHOW VARIABLES LIKE 'character%' through ShardingSphere-Proxy and MySQL. Done means the proxy accepts the requested character set and reports matching client, connection, and results settings.

Written by the indexing model from the issue text.

Assessment

Tech stack
mysql
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.