I have the following line:
Hello. Hello.
If you look at a line in a hex editor, it looks like this:
48 65 6C 6C 6F 2E 20 A0 20 20 48 65 6C 6C 6F 2E
Pay attention to A0 in the middle. (This is a space character without a space).
A0 breaks the JavaScript that I use, so I would like to remove it when the string is pre-processed by a PHP script.
If I use the following code:
$text = preg_replace("/\xA0/"," ", $text);
A0 is replaced by 00 , which is also an unpleasant symbol.
As you can see from the preg_replace function, it should be replaced with a space or 20 .
Do any of you know how I can get rid of this unpleasant A0 symbol?
Thanks.
EDIT: I am using Windows-1252 and cannot switch to UTF-8. This will not be a problem if you use UTF-8 ...
user1644380
source share