Solve the Golang in the web development of the front end of the inexplicable blank line _golang

Source: Internet
Author: User

Problem:

When using Golang to do web development, sometimes the rendered template appears in the foreground with some strange blank wrapping, which is characterized by the view that there is no blank part of the definition in the CSS style sheet.

Analysis:

To view the page source code of the problem page, copy the blank newline part of the transcoding code for Unicode and find that \u2028 it contains such characters as "figure I".


"Figure I"

In addition, directly in the browser check inside the HTML selection edit as HTML, you can also find that there are small red dots in the white space, the mouse will be directly moved to show that the character is \u2028 "figure two." Lookup data found that this line break is not supported in JavaScript.


"Figure II"

Workaround:

In the Web page check can be found, directly remove these small red dots can solve the problem. There is a direct front-end processing online, that is, to search the page \u2028 and replace it \\u2028 , of course, can also be used in the background Golang processing, that is, before the output of HTML to retrieve the content, and replace it.

Strings. Replace (HTML, "\u2028", "",-1)

Well, the above is the entire content of this article, I hope for everyone's study and work can bring help. If you have questions, you can exchange messages.

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.