Front HTML space and background PHP utf-8 space

Source: Internet
Author: User

An issue was found today when working with the HTML input box:

In the User name input box, enter admin "' p (in the middle is a space), point to save the background prompt data saved successfully, supposedly not modified, through the Chrome debugging tool found to the background data is like this:

data_mark=&user=admin%c2%a0%'p&ip=1.2.3.4&pwd=&status=0 &edit_type=edit

That is, the browser to the space to the "%c2%a0", the database and the foreground display are normal and have a space, but take out the comparison, they are completely unequal , through the search learned:

Front-end Space:   ;  &#xA0 to the background is UTF-8 spaces: C2 A0 ASCII 194 + 160

So in the background to get Urser data after the space conversion, you can normally save data

$data ['user'] = Str_replace (Chr (194). chr // utf-8 Spaces

Reference:

Https://en.wikipedia.org/wiki/Non-breaking_space

Https://www.cnblogs.com/oldphper/p/4128138.html

Front HTML space and background PHP utf-8 space

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.