Mystery hidden characters in JS code


#1

I’m learning how to use React-native. I’m doing the beginner examples, thought I’d get fancy and copy a nice sample from a webpage into my code. (Atom.io tells me I’m using UTF-8 encoding)

Unfortunately the code won’t run. I get an error on load image in the xCode Apple iOS simulator. The defect is identified as “Unexpected character” at location (line# position#)

So I look at my code in Atom.io, and I’m playing with the keyboard left / right arrow keys. I notice that at a certain place in my code the arrow keys are pressed twice but there is no movement of my cursor. Its right at the start of the first line of code that I copied. I was able to “highlight” the hidden mystery “letters” and delete them. After I did that as was successful at the iOS simulator.

It certainly looks like there were two characters in my .js code that were not visible in Atom.io

So here is my question: Is that a bug in Atom.io? Obviously (tabs) (carriage returns) are acceptable hidden characters, but this, at the front of a line doesn’t make any sense.

I’m using Mac Mini, OS X Yosemite v 10.10.5. Atom 1.6.2
The code I copied was the iOS Slider Example Code from https://rnplay.org/apps/5FsfPA and I used a “Select All” and Command-C to do the copying and Command-V to paste… if anybody wants to repeat the experiment. The mystery characters were located at the very front of the pasted text, right before 'use strict';


#2

If they’re at the very front of the text, then they are most likely a Unicode BOM. And there are lots of characters in the Unicode system that are unprintable by definition. I’ve used the hex package in the past to see exactly how a file is encoded.