MySQL ASCII codes
In Python, the ord() function returns a ascii code between 0 and 255
>>> ord("a")
97
>>> ord("b")
98
>>> ord("c")
99
>>> ord("á")
225
>>> ord("í")
237
>>> ord("Ñ")
209
But in MySQL, I'm unable to get those higher codes, even using charset modifiers:
mysql> SELECT ord("a"),ord("b"),ord("c");
+----------+----------+----------+
| ord("a") | ord("b") | ord("c") |
+----------+----------+----------+
| 97 | 98 | 99 |
+----------+----------+----------+
mysql> SELECT ord("á"),ord(_utf8"á"),ord(_utf8mb4"á"),ord(_latin1"á");
+-----------+----------------+-------------------+------------------+
| ord("á") | ord(_utf8"á") | ord(_utf8mb4"á") | ord(_latin1"á") |
+-----------+----------------+-------------------+------------------+
| 50081 | 50081 | 50081 | 195 |
+-----------+----------------+-------------------+------------------+
mysql> SELECT ascii("á"),ascii(_utf8"á"),ascii(_utf8mb4"á"),ascii(_latin1"á");
+-------------+------------------+---------------------+--------------------+
| ascii("á") | ascii(_utf8"á") | ascii(_utf8mb4"á") | ascii(_latin1"á") |
+-------------+------------------+---------------------+--------------------+
| 195 | 195 | 195 | 195 |
+-------------+------------------+---------------------+--------------------+
How can I get those 225, 237 or 209 codes in MySQL? Which function? which character set?
Subject
Written By
Posted
MySQL ASCII codes
January 08, 2019 07:59PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.