What is the encoding of the whitespace characters in this string? I can't replace it with "\s."
Test code:
$url = ' Http://www.google.com/ig/calculator?hl=en&q=1USD=?tzs ';
$str = @file_get_contents ($url);
$str = Preg_replace ("/[\s\v\t\r\n]+/", "", $str);
echo "str: $STR";
In the output, the blank character after the "1 631.32137Tanzanianshillings" front "1" is old.
Also please understand the friend pointing ah, thank you!
Share to:
------Solution--------------------
echo Htmlspecialchars ($STR);
The entity HTML is not a space, the effect is a space
------Solution--------------------
Then replace it, too.
------Solution--------------------
is also a blank HTML symbol
------Solution--------------------
You know, that's a little bit of a space.
------Solution--------------------
First, put all the double quotes in single quotes and try again.
------Solution--------------------
In $str = @file_get_contents ($url);
$str =iconv ("GBK", "Utf-8//ignore", $str);
With this, the conversion can be replaced, because there are unrecognized characters in the acceptance process, so that a conversion can identify