4 ms·
I had something similar happen in the wild to me. I work for a "major search engine" that does a lot of advertising & marketing stuff. To get the most out of
by mattlondon 11y ago
I had something similar happen in the wild to me.
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 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.
- slowmotiony 11y agoI would probably have to quit my job before I could figure out that problem. May I ask how did you spot it?
- slig 11y agoSomething similar happen to me, but with that fancy quotes. I spotted by doing a "binary-search weird bug hunt". Cut half of the code off and see it it's still complaining, if it's, cut the other half, and so on.
- jprince 11y agoAh, that old stand-by. Always warm and ready for the odd unicode hell-bug.
- sethammons 11y agoI had a similar problem. Copied a code snippet. Ruby started complaining about an undefined function. After nearly going mad, and then looking at the source through a hex editor, you could see Unicode whitespace. I have yet to forgive ruby or Unicode whitespace. Or the chat utility from whence I copied.
- austinjp 11y agoWeird bugs can respond well to brutally dumb debugging. Open file and search for ; perhaps? Or grep etc. When you can see semi-colons but your find tool can't, that's a worry. But yeah getting to that point relies on pure inspiration, in my case.
- err4nt 11y agoI find searching, and search and replace the most useful IDE feature, you can reformat entire documents with a series of well thought out search and replaces:)
- falcolas 11y agoPersonally, my vim status line has an indicator which shows the hex code for the rune currently under the cursor. After fighting against word processor quotes, it's become second nature to double check it periodically.
- coldpie 11y agoCool! How do you do that?
- leephillips 11y agoI'd like to know, too. Until then, you can type "ga" in normal mode to get a display of the decimal, hex, and octal value of the character under the cursor.
- iamcurious 11y agoThat seems useful. Can you share it?
- falcolas 11y agoHere you go: :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`
- mattlondon 11y agoIt was a while ago now, but I remember copying the code out to a controlled isolated environment on my local machine, picking the first line and making sure it reproduced. 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/ http://unicode-table.com/en/ it will tell you right away what it really is.
- podgib 11y agoI've been bitten by things like this so many times, that my first reaction on seeing an inexplicable syntax error is to delete and manually re-type the line.
- TazeTSchnitzel 11y agoI was recently bitten by OS X's non-breaking space shortcut. I'd accidentally typed alt+space instead of space due to typing a following # (alt+3), and that made weechat, an app unaware of the NBSP, see the command '/join #channel' instead of '/join'.