Created
December 15, 2021 01:15
-
-
Save yoku0825/b7f458f06cc78edb342f87b8da816b57 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql80 26> SELECT x'E8919BF3A08481', LENGTH(x'E8919BF3A08481'), CHARACTER_LENGTH(x'E8919BF3A08481'); | |
+-------------------+---------------------------+-------------------------------------+ | |
| x'E8919BF3A08481' | LENGTH(x'E8919BF3A08481') | CHARACTER_LENGTH(x'E8919BF3A08481') | | |
+-------------------+---------------------------+-------------------------------------+ | |
| 葛󠄁 | 7 | 7 | | |
+-------------------+---------------------------+-------------------------------------+ | |
1 row in set (0.00 sec) |
@nori-shinoda Wow, thank you!!
mysql80 8> SELECT x'E8919BF3A08481', LENGTH(x'E8919BF3A08481'), CHARACTER_LENGTH(x'E8919BF3A08481' COLLATE utf8mb4_bin), SUBSTR(x'E8919BF3A08481',
1, 2);
ERROR 1253 (42000): COLLATION 'utf8mb4_bin' is not valid for CHARACTER SET 'binary'
Treat it as varbinary
..
それはそうとして CHAR_LENGTH が2はなんかアレなので一応
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems that the correct result will be obtained if it is stored in the table.
mysql> SELECT version();
+-----------+
| version() |
+-----------+
| 8.0.27 |
+-----------+
1 row in set (0.00 sec)
mysql> CREATE TABLE ivs1(c VARCHAR(10)) COLLATE 'utf8mb4_bin';
Query OK, 0 rows affected (0.01 sec)
mysql> INSERT INTO ivs1 VALUES (x'E8919BF3A08481');
Query OK, 1 row affected (0.00 sec)
mysql> SELECT c, LENGTH(c), CHARACTER_LENGTH(c) FROM ivs1;
+---------+-----------+---------------------+
| c | LENGTH(c) | CHARACTER_LENGTH(c) |
+---------+-----------+---------------------+
| 葛? | 7 | 2 |
+---------+-----------+---------------------+
1 row in set (0.00 sec)