Skip to content

Support for custom charset #149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
swordfeng opened this issue Mar 25, 2019 · 7 comments
Closed

Support for custom charset #149

swordfeng opened this issue Mar 25, 2019 · 7 comments

Comments

@swordfeng
Copy link

The client is creating connections using the default charset mapping, which maps UTF_8 to utf8mb3. However, many DBs use utf8mb4 in order to support 4-byte unicode. Is there a way to customize the charset settings? Maybe passing in a CharsetMapping as a parameter or specifying a charset code.

@swordfeng swordfeng changed the title Support for Custom Charset Support for custom charset Mar 25, 2019
@oshai
Copy link

oshai commented Mar 31, 2019

you can try to set a charset option on the configuration. see DEFAULT_CHARSET here: https://github.com/vert-x3/vertx-mysql-postgresql-client/blob/12a6e6f894/vertx-mysql-postgresql-client-jasync/src/main/java/io/vertx/ext/asyncsql/impl/MYSQLClientImpl.java

Although I haven't tested it myself.

@swordfeng
Copy link
Author

That does not work well, actually. From here you can see it always using the default charset mapping and from here you can find only 83, 65, 69 valid. Other values seem not supported.

@oshai
Copy link

oshai commented Apr 3, 2019

Yes, I see.
I couldn't find the value for the utf8mb4 in mysql docs. what I did find is that this is the default since 8.0.1.

If you have an idea of that value we can try that out.

@swordfeng
Copy link
Author

I think the “SHOW COLLATION” statement should give you the id. An example: https://dev.mysql.com/doc/refman/8.0/en/charset-mysql.html

@oshai
Copy link

oshai commented Apr 4, 2019

from reading this post. it looks like older utf in mysql was not totally compatible.
What I think to do is to change utf8 type in the protocol like this: CharsetUtil.UTF_8 to 224.

I tested it and it works. it might affect legacy databases that do not support this charset.

I will open an issue in jasync-sql itself for this.

@oshai
Copy link

oshai commented Apr 7, 2019

@swordfeng - you're welcome to test it with jasync 0.9.50.

@swordfeng
Copy link
Author

@oshai Tested and it looks good! I think I can close the issue now. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants