After that it was a matter of just going through the usual steps of working out why something isn't working. I think in this instance I actually ended up manually retyping the code, and when getting "identical" code that worked that was when the penny dropped and I realised something was not what it seemed. If you paste suspect characters into something like http://unicode-table.com/en/ it will tell you right away what it really is.
But yeah getting to that point relies on pure inspiration, in my case.
After fighting against word processor quotes, it's become second nature to double check it periodically.
It protects you from these tricks by highlighting "troll" unicode characters in red.
:syn match Error "[^ -~]" :set statusline=%F%m%r%h%w\ [TYPE=%Y]\ [ASCII=\%03.3b]\ [HEX=\%02.2B]\ [POS=%04l,%04v][%p%%]\ [LEN=%L]
:set laststatus=2
Produces a status line when inserting and recording a macro like (the character under the cursor is 'm': ~/.vimrc [TYPE=VIM] [ASCII=109] [HEX=6D] [POS=0123,0020][67%] [LEN=182]
-- INSERT --recording
And, of course... `:help statusline` [ASCII=2>4] [HEX=0>4]
It's not ASCII, and its hex code is 6BCF.It also says "ASCII=252" when I put the cursor over "ü". Claiming that values over 127 are ASCII is just a malapropism.
For us emacsen you can do a (what-cursor-position &optional DETAIL) which is usually bound to Ctl-x =
I don't think it will be nearly this clean to add it to the modeline, but I'll take a look.
I work for a "major search engine" that does a lot of advertising & marketing stuff. To get the most out of it, we need customers to implement some javascript on their ecommerce sites.
As is often the case, javascript code that needs to get implemented on an ecommerce site often gets copy-pasted or emailed around a lot internally within a customer before it reaches the right person who can add it to the site's pages.
In this example somewhere along the way, a normal javascript snippet got all of the semi-colons changed from ; to ;.
In case you've not already spotted it, ; is not a ; but is actually "Greek Question Mark" (http://www.fileformat.info/info/unicode/char/037e/index.htm).
It was very confusing why Chrome was moaning about a semi-colon an illegal token. I had a genuine "Am I going mad? Seriously?" moment before I realised what was happening.