You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns the numeric value of the leftmost character of the string str. Returns 0 if str is the empty string. Returns NULL if str is NULL. If the input is not in the ASCII range, return NULL. ASCII() works for 8-bit characters.
If the input is not in the ASCII range, return NULL.
Does this mean that if the input is Chinese, , NULL will be returned, which is not the same as the return value of mysql
mysql> select ascii("你好");
+-----------------+
| ascii("你好") |
+-----------------+
| 228 |
+-----------------+
1 row in set (0.00 sec)
MySQL's ASCII function is supposed to work only with 8-bit characters. The result with Non-ASCII characters are wrong. To get the decimal value of Non-ASCII characters, ORD() function is proposed.
So we should not follow this wrong behavior of MySQL, we could implement this function only with ASCII characters within 128.
Activity
wuliuqii commentedon May 22, 2022
I'd like to work on this issue.
wuliuqii commentedon May 22, 2022
I have a question.
Does this mean that if the input is Chinese, , NULL will be returned, which is not the same as the return value of mysql
dengn commentedon May 22, 2022
MySQL's ASCII function is supposed to work only with 8-bit characters. The result with Non-ASCII characters are wrong. To get the decimal value of Non-ASCII characters, ORD() function is proposed.
So we should not follow this wrong behavior of MySQL, we could implement this function only with ASCII characters within 128.