sivashanmugam kannan sivashanmugam kannan - 3 months ago 7x
Node.js Question

String has hidden characters, Can't able to verify ,

I asked a question some 2 hours before

[Not required to see the question, Just a reference ]
Storing images using node.js gives error

The solution given was was literally the same of my code, I tried to find the difference between my code and his code to see what's the modification he did to make it work, But there is nothing modified.

So i thought of trying it online IDE and i tried online IDE to check it. But suddenly something showed up little bit strange in the online IDE which my local sublime editor did't show it.

The below image is text which i saw in sublime, Which does't have any

enter image description here


The below is the text i found in . As you can see clearly there is
two dots
showed up newly in javascript editor.

enter image description here

I could not able to see the difference that in normal text editor, Then in online
different checker also showed the error.

enter image description here

Ths below is the text which has the hidden difference between two strings



Just copy paste the above text in after then you could see the difference between the above
two strings

Can anyone tell what's the reason for this and how to remove the unwanted characters from the string through a javascript function. It's been giving one hell of a problem for 5 hours in my server.


There are 2 Unicode characters between the n and the _, a ‌ zero width non-joiner followed by a zero width space.

Seeing them will depend on the editor/font you use and how it decides to display this class of non-printable character - if at all.

To remove them:

newStr = oldStr.replace(/[\u200c\u200b]/g, "");