Be careful with ASCII issue when working with text

Jelly Tran
2 min readAug 12, 2020

--

Today I encountered a weird bug, which I later found out relating to ASCII characters.

The story is, when I compare 2 exact same string , the result is always false, but by naked eyes, there are no difference between them @@

Accidentally, I copied and paste those string to the browser console and found out they contain weird red character, so that’s the reason why the 2-string-compare function returns false

Strings displayed in VScode:

String actually displayed in the browser console:

I went to https://pteo.paranoiaworks.mobi/diacriticsremover/ to remove redundant characters and everything back to normal.

Small bug, but it costs me tons of time and makes me question my mental ability haha

--

--

Jelly Tran
Jelly Tran

Written by Jelly Tran

jelly, web developer, currently in Singapore

Responses (1)