String Processing problems preg_replace (). if there is a strange replacement, please solve it.

Source: Internet
Author: User
String processing problem preg_replace (). if there is a strange replacement, please solve it! Http: //. com/item.htm? Id = 14135039282 & amp; ref = http % 3A % 2F % 2Fsearch8.taobao.com % 2 Fsearch % 3Fq % 3D % 25C4% string processing problem preg_replace (), Strange replacement, please solve it!
Http: //. com/item.htm? Id = 14135039282 & ref = http % 3A % 2F % 2Fsearch8.taobao.com % 2 Fsearch % 3Fq % 3D % 25C4% 25DA % 25BF % 25E3% 2B % 25C4% 25D0% 26cat % 3D50026972% 26 commend % 3 Dall % 26 style % 3 Dgrid % 26 ppath % 3D2048150% 253A105206% 26cps % 3 Dyes % 26pid

The above is the original string. Why does it go through the following processing?


', Htmlentities ($ rw ['content'], ENT_QUOTES, GB2312)?>



After processing, it is displayed as this way. please note? Automatic line feed after the No.
Http: //. com/item.htm?
Id = 14135039282 & ref = http % 3A % 2F % 2Fsearch8.taobao.com % 2 Fsearch % 3Fq % 3D % 25C4% 2

Another question is that the strings stored in the database are as follows:
Me
Me
Me
Me

After ', Htmlentities ($ rw ['content'], ENT_QUOTES, GB2312)?> After this processing, it is displayed as follows:
Me
Me
Me
Me

Why do we replace a space here? If \ n is added to the layer-in mode, the above situation will not occur.

------ Solution --------------------
You don't have to solve it any more. this is not a problem at all. even if you directly echo it ,? A new line will also be added later. the browser treats the string between question marks as a word. if the word length exceeds one screen, the new line will be rolled back. The same effect will be achieved when the word is used to edit English, so it's just about the browser.
You can insert question marks in the following section and adjust the browser width.
PHP code
  

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.