I posted this under php, but should have posted it here..
Is there a way in mysql to select rows that contain non-English characters such as Ã, ¢, etc.
Thanks!
Select where non-english characters
Moderator: General Moderators
Code: Select all
mysql> select * from q;
+----+-----------+
| id | t |
+----+-----------+
| 1 | что-то |
| 2 | something |
+----+-----------+
2 rows in set (0.00 sec)
mysql> select * from q where t regexp '[^A-Za-z]';
+----+--------+
| id | t |
+----+--------+
| 1 | что-то |
+----+--------+
1 row in set (0.00 sec)Well, here's another way:GeXus wrote: That won't work because I have some periods, ampersands, etc. that would get selected by that.
Code: Select all
mysql> select * from q;
+----+-----------+
| id | t |
+----+-----------+
| 1 | что-то |
| 2 | something |
+----+-----------+
2 rows in set (0.00 sec)
mysql> select * from q where cast(t as binary) != cast(convert(t using ascii) as
binary);
+----+--------+
| id | t |
+----+--------+
| 1 | что-то |
+----+--------+
1 row in set (0.00 sec)Bingo! Thank you!
Weirdan wrote:Well, here's another way:GeXus wrote: That won't work because I have some periods, ampersands, etc. that would get selected by that.Code: Select all
mysql> select * from q; +----+-----------+ | id | t | +----+-----------+ | 1 | что-то | | 2 | something | +----+-----------+ 2 rows in set (0.00 sec) mysql> select * from q where cast(t as binary) != cast(convert(t using ascii) as binary); +----+--------+ | id | t | +----+--------+ | 1 | что-то | +----+--------+ 1 row in set (0.00 sec)