mysql icon indicating copy to clipboard operation
mysql copied to clipboard

Example and docs on encodings

Open anarthal opened this issue 2 years ago • 1 comments

Character encoding is something that causes confusion. This section talks about it briefly, but it's not enough. Add a section and possibly an example.

Sample question:

If i have a table with three columns, one in utf8, the other one in utf-16, and the last one in iso8859-15, what will the returned string_view contain? And if I'm filtering in a WHERE clause, what encoding should the WHERE clause have? Is it the same in text queries and in prepared statements?

anarthal avatar May 19 '22 21:05 anarthal

Is that even possible, to have different encodings per-column or per-table? PostgreSQL and Oracle has a single per-DB encoding for storage. And another for each session. It's typically highly recommended to use UTF-8 (or another lossless UTF-X one) for storage. Then each client/session is free to use its own encoding, at the (opt-in) risk of non-lossless conversions.

ddevienne avatar May 20 '22 06:05 ddevienne