I have a weird whitespaces in string, white spaces are not white spaces. I have a problem with converting them with regex and str_replace i.e.
echo str_replace(' ','_',$str开发者_如何学JAVAing);
any ideas how to fix it? utf8_encode is also not working, regex \s either, when you copy this text to Notepad++ it shows as
Ê
instead of white space.
What I am trying to achieve is to run this regex
preg_replace('/[^a-z0-9 ]/i','',$string)
but since those 'whitespaces' are not a whitespaces they are being removed as well.
I think I got it, from PHP site:
You might wonder why
trim(html_entity_decode(' '));
doesn't reduce the string to an empty string, that's because the ' ' entity is not ASCII code 32 (which is stripped by trim()) but ASCII code 160 (0xa0) in the default ISO 8859-1 characterset.
精彩评论