Hacker News Re-Imagined

Beware of the Unicode no-break space (0xC2 0xA0)

Hi all!

Yesterday I saw a very strange behavior while working with some tags, I thought this was a bug!

Can you spot the difference? (https://jsfiddle.net/vbjtcf3d/)

<div pagews-snapshot="true" referenceid="remotemkt.listws.app" snapshotid="snapshot/board-companies" ></div>

the other ( https://jsfiddle.net/q9d08xp1/ )

<div pagews-snapshot="true" referenceid="remotemkt.listws.app" snapshotid="snapshot/board-companies" ></div>

Both looks exactly the same!, but only one is working....

It turn out that it was an unicode character issue, the spacing between the non working tag was using the unicode non-breaking space (0xC2 0xA0), when I replaced the spaces with the regular space character (0x20) everything worked again.

I think that I copied this tag from an email, I will be extra careful in the future for this kind of issues.

It took me a while to find out this, I hope this could help anyone, if your attributes are null and you are sure that they are present check you html with a hex editor.

Let me know your thoughts

2 hours ago

Created a post 3 points @vicjicama

Beware of the Unicode no-break space (0xC2 0xA0)

@mikewarot 1 hour

Replying to @vicjicama 🎙

Thanks for the heads up. Life sure seemed simpler when it was just ASCII and American English to worry about. ;-)

Reply


About Us

site design / logo © 2021 Box Piper