The online version of the tool can be found here:Ī working example can be seen with the url of this question that contains one ocurrence: This way you can actually know where the spaces are and edit your page properly to remove them. Replaces and highlights the ocurrences with something more visible.Looks for occurrences of chr(194).chr(160) in the HTML contents.This is not actually an answer to the question but instead a tool that can be used to detect this special white space in the html of the pages of a website so we can proceed to locate and remove it. To the people in the future like myself that had to debug this from a high level all the way down to the character codes, I salute you. To convert the character with a character in a string, try this. The difference between the two is that a whole bunch of repeated after one another will hold their ground and create additional space between them, whereas a whole bunch of repeated characters will squish together into one space.Ī B results in: A BĪ B results in: A B Whereas copiedSpace.charCodeAt(0) returns 160, the AKA character. TypedSpace.charCodeAt(0) returns 32, the classic space. It turns out the two seemingly identical whitespace characters are not the same character.īehold: var characters = Īlert("Typed: " + characters.indexOf(typedSpace)) // -1Īlert("Copied: " + characters.indexOf(copiedSpace)) // 4Īlert(typedSpace = copiedSpace) // false Here's the HTML of the same text you see when you view source. Image for people not using chrome (this is looking at this very post via chrome dev tools): Now look in console and only the one will be a, yet the raw source is identical. view source on this page and you will see two empty " " like normal. If i do it with the broken space I also get 32.Įdit: you can prove this. I have tried inspecting the actual character code and it's a regular space from all things I can find.Įvery single method I try shows it as a NORMAL space. I have these stupid characters show up everywhere randomly in my website and I have no idea where they come from, or WHY is google converting a SPACE into a nbsp Even though whats copied in your clipboard is just a SPACE. You can even copy it and paste it everywhere and wreak havoc and make chrome put everywhere. Here's just with hitting the space key (which works fine). I could understand if it's some kind of rich text editor or something, but in the raw html source is a regular space, so what gives? (also, the character I copied was an actual space). normal right? Now right click and actually view the source of this stack overflow page. it defies everything that I can think of. This is driving me absolutely, !&%&$ insane.
0 Comments
Leave a Reply. |