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.