What is the encoding of the white space character in this string? Can't replace with "s"

Source: Internet
Author: User
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
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.