Is there anyway to detect Chinese characters (Simplified or Traditional) using Postgresql?
Asked
Active
Viewed 2,370 times
1
-
1Welcome to `StackOverflow[SO]`, please be a bit more specific [when asking question](https://stackoverflow.com/help/how-to-ask): What have you tried so far with code example? / What do you expect? / What error do you get? – Hille Nov 29 '17 at 13:27
-
I can check for non Ascii characters like this: column_name ~ '[^[:ascii:]]' But i need only Chinese chars.... – Fotis Mihos Nov 29 '17 at 13:41
-
You should do some coding on your own and show us how far you got... We **do not** write full codes for **free!** – Hille Nov 29 '17 at 13:45
-
You can detect Chinese characters like this: **column_name** ~ '[\x4e00-\x9fff]' – Fotis Mihos Nov 29 '17 at 14:54
-
Btw i have no clue about postgresql, but i wanted to help you with building a acceptable question. But if you don't do your part, than i can't help you. See ya – Hille Nov 29 '17 at 14:56
1 Answers
7
column_name ~ '[\x4e00-\x9fff]'

Mike Causer
- 8,196
- 2
- 43
- 63

Fotis Mihos
- 99
- 4
-
There are a few more unicode ranges to take into account; see the answers [here](https://stackoverflow.com/questions/1366068/whats-the-complete-range-for-chinese-characters-in-unicode) for details. You can put multiple ranges into the same regex character class, e.g. `column_name ~ '[\x4e00-\x9fff\x3400-\x4dbf]'` – Nick Barnes Nov 29 '17 at 15:15
-