i want to allow all utf8 character but want to replace non utf8 with space or -
this is the string
Punjab me 1Train k niche 100 Sardar aa gaye..
99 Mar gaye...
1 Bach gaya
whatever i do it is not inserting after train
its trimming at train
i have tried these two links
- Remove non-utf8 characters from string
- Replacing invalid UTF-8 characters by question marks, mbstring.substitute_character seems ignored
i want complete utf8 range to insert in mysql and replace the non utf8 with either space or -
$string = preg_replace('/[^(\x20-\x7F)]*/','', $string);
works for above case but when i use hindi/chinese it replaces that too.so i cant use above code