Echo comes out with a string containing ' and '? ', why?

Source: Internet
Author: User
Keywords PHP garbled
Like what:

  header("Content-Type:text/html;charset=utf-8");  $a='adminn流hn–h';  echo $a;  

Results: Adminn Flow hn–h
Correct

If, ' Adminn stream hn–h ' exists in the field of MySQL with the properties of utf8_general_ci, the result of ECHO is:
Adminn?hn h

Ask

Reply content:

Like what:

  header("Content-Type:text/html;charset=utf-8");  $a='adminn流hn–h';  echo $a;  

Results: Adminn Flow hn–h
Correct

If, ' Adminn stream hn–h ' exists in the field of MySQL with the properties of utf8_general_ci, the result of ECHO is:
Adminn?hn h

Ask

Is the problem of character encoding, the header is added UTF8 on the line. You can first look at the output garbled page encoding is what, if not utf8 on the header if it is, then look at your PHP file is what encoding. and make it into a utf8.

The file code should be kept consistent with the header.

If you exclude the other most likely, the last reason is the browser, another one is normal

Adjust the code of the browser

Use notepad++ to see what the file encoding is? Be sure to keep the code in line with the header.

That's right upstairs.

File encoding problem, look at the specific code on the line

  • 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.