PHP: regex to remove `Γ’` or` Γ’ € `?

I use this regex to remove all punctuation from string input,

$pg_url = preg_replace("/\W+/", " ", $pg_url); 

but there are some characters or special characters that I cannot delete, for example

 – 

when i pass this into my db injection it will either turn into Γ’orÒ€

How can I get rid of these strange things?

Thank.

+3
source share
1 answer

These characters are encoded in Unicode , in particular UTF-8 .

You might want to use iconv family to convert them to some other encoding (for example, simple ASCII).

+1
source

Source: https://habr.com/ru/post/1786968/


All Articles