| Bug #105394 | introducer _ucs2 not working | ||
|---|---|---|---|
| Submitted: | 31 Oct 2021 23:46 | Modified: | 1 Nov 2021 5:11 |
| Reporter: | Rick James | Email Updates: | |
| Status: | Verified | Impact on me: | |
| Category: | MySQL Server: Charsets | Severity: | S3 (Non-critical) |
| Version: | all, 5.7, 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | charset, conversion, ucs2 | ||
[1 Nov 2021 5:11]
MySQL Verification Team
Hello Rick James, Thank you for the report and feedback. regards, Umesh
[2 Nov 2021 8:32]
Roy Lyseng
According to MySQL documentation, this is working as expected, and could be classified as not a bug: The _charset_name expression is formally called an introducer. It tells the parser, “the string that follows uses character set charset_name.” An introducer does not change the string to the introducer character set like CONVERT() would do. It does not change the string value, although padding may occur. The introducer is just a signal.

Description: SELECT HEX(_ucs2"HELLO"), HEX(CONVERT("HELLO" USING ucs2)); +-------------------+----------------------------------+ | HEX(_ucs2"HELLO") | HEX(CONVERT("HELLO" USING ucs2)) | +-------------------+----------------------------------+ | 0048454C4C4F | 00480045004C004C004F | +-------------------+----------------------------------+ _ucs2 seems to apply to only the first character; seems like it should apply to the entire string. https://stackoverflow.com/questions/69775663/mysql-char-lengthstr-sometimes-produces-diffe... How to repeat: SELECT HEX(_ucs2"HELLO"), HEX(CONVERT("HELLO" USING ucs2));