66

I noticed on my website, http://www.cscc.org.sg/, there's this odd symbol that shows up.

enter image description here

It says L SEP. In the HTML Code, it display the same thing.

enter image description here

Can someone shows me how to remove them?

BigRedDog
  • 928
  • 1
  • 7
  • 15
  • 6
    Possible duplicate of [Why is this symbol showing up on Chrome and not Firefox or Edge?](http://stackoverflow.com/questions/39603446/why-is-this-symbol-showing-up-on-chrome-and-not-firefox-or-edge) – mplungjan Jan 09 '17 at 19:26
  • How do I remove it? Or disable it from showing on the browser? Do i have to go to the code and remove the separator manually? Thanks! Is there a way to automate to remove these characters before they show up? – BigRedDog Jan 09 '17 at 19:27
  • You need to delete the two chars in the code in the page and fix your database. See the duplicate – mplungjan Jan 09 '17 at 19:27
  • http://stackoverflow.com/questions/14179377/how-to-replace-escape-u2028-or-u2029-characters-in-php-to-stop-my-jsonp-api-br – mplungjan Jan 09 '17 at 19:30
  • 2
    and use a
    instead.
    – Eduardo Chongkan Oct 22 '19 at 08:58
  • Same issue shows up in some MS Word documents, and the solution is similar: open the find/replace dialog, and search for ^u8232 and replace with a space or return depending on what you intended. – jsm May 13 '23 at 16:06

4 Answers4

34

That character is U+2028 or HTML entity code 
 which is a kind of newline character. It's not actually supposed to be displayed. I'm guessing that either your server side scripts failed to translate it into a new line or you are using a font that displays it.

But, since we know the HTML and UNICODE vales for the character, we can add a few lines of jQuery that should get rid of the character. Right now, I'm just replacing it with an empty space in the code below. Just add this:

$(document).ready(function() {
    $("body").children().each(function() {
        $(this).html($(this).html().replace(/
/g," "));
    });
});

This should work, though please note that I have not tested this and may not work as none of my browsers will display the character.

But if it doesn't, you can always try pasting your text block onto http://www.nousphere.net/cleanspecial.php which will remove any special characters.

data
  • 2,563
  • 1
  • 21
  • 25
thatguy
  • 1,249
  • 9
  • 26
  • Thanks. Where do I add this code? In the header? Can I add it as a function in the WP theme? – BigRedDog Mar 11 '18 at 02:54
  • I would Add the code to its own file, but that's because i like to keep my scripts separate from my HTML and CSS, you can put it just about anywhere though. the $(document).ready() function will get called when the page is loaded. Just use the add script button for WordPress. – thatguy Mar 12 '18 at 16:58
  • 1
    I think you would wan to replace the new line marker with a compatible new line character... If it's just an HTML document, just replace them with
    and that should do it... though it would be better to have a more compatible new line character rather than adding HTML, in the case that the document or the text block is not HTML enabled...
    – OG Sean Jan 14 '19 at 18:53
  • 8
    Just a note: Calling JS replace globally sometime have strange side-effects which are very hard to debug.. If you are the site owner, deal with it on the server-side. –  Mar 24 '20 at 10:29
  • also this sound horrible performance wise ... – Bergrebell Aug 04 '22 at 12:56
11

Some fonts render LS as L SEP. Such a glyph is designed for unformatted presentations of the character, such as when viewing the raw characters of a file in a binary editor. In a formatted presentation, actual line spacing should be displayed instead of the glyph.

The problem is that neither the web server nor web browser are interpreting the LS as a newline. The web server could detect the LS and replace it with <br>. Such a feature would fit well with a web server that dynamically generates HTML anyway, but would add overhead and complexity to a web server that serves file contents without modification.

If a LS makes its way to the web browser, the web browser doesn't interpret it as formatting. Page formatting is based only on HTML tags. For example, LF and CR just affect formatting of the HTML source code, not the web page's formatting (except in <pre> sections). The browser could in principle interpret LS and PS (paragraph separator) as <br> and <p>, but the HTML standard doesn't tell browsers to do that. (It seems to me like it would be a good addition.)

To replace the raw LS character with the line separation that the content creator likely intended, you'll need to replace the LS characters with HTML markup such as <br>.

Edward Brey
  • 40,302
  • 20
  • 199
  • 253
  • 10
    Only sensible answer here. Please don't fix the symptoms with awful jQuery scripts. Delete the errant character at the source. – jameshfisher Sep 14 '20 at 09:53
3

This is the solution for the 'strange symbol' issue.

$(document).ready(function () {
  $("body").children().each(function() {
      document.body.innerHTML = document.body.innerHTML.replace(/\u2028/g, ' ');
  });
})
Ramanathan
  • 216
  • 2
  • 7
2

The jquery/js solutions here work to remove the character, but it broke my Revolution Slider. I ended up doing a search replace for the character on the wp_posts tabel with Better Search Replace plugin: https://wordpress.org/plugins/better-search-replace/

When you copy paste the character from a page to the plugin box, it is invisible, but it does work. Before doing DB replaces, always have a database (or full) backup ready! And be sure to uncheck the bottom checkbox to not do a dry run with the plugin.

Snuwerd
  • 459
  • 3
  • 6