Reputation: 1
In send mail function I have code for decoding header:
preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/', $str, $matches);
If in string is a symbol, for example ä
(März) then it will return an empty string. Please help me, how can I fix it (for use with German symbols too)?
Thanks!
Upvotes: 0
Views: 65
Reputation: 19
Try adding the u
flag outside the delimiters:
$str="März";
preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/u', $str, $matches);
print_r($matches);
If your PHP file is encoded as UTF-8, you can also use special characters inside the pattern:
preg_match_all('/[Mäz]/u', $str, $matches);
print_r($matches);
You can test it here.
Upvotes: 1
Reputation: 91385
Just add /u
flag for unicode:
preg_match_all('/[\000-\010\013\014\016-\037\177-\377]/u', $str, $matches);
# here __^
Upvotes: 1