5 ms·
Great example of why Unicode and source code do not mix well... it reminds me of when I taught CS courses and had a few instances of very confused students who
by userbinator 6y ago
Great example of why Unicode and source code do not mix well... it reminds me of when I taught CS courses and had a few instances of very confused students who managed to somehow get one of those "invisible formatting characters" into their files. Fortunately, a hexdump --- or even just an "old school" ANSI-only editor --- reveals all.
- andreareina 6y agoEmacs and IIRC vim highlight control characters and nonstandard whitespace. I kinda thought it standard for code editors.
- addcninblue 6y agoFor vim, it's under the listchars setting, in case anyone wanted to know! (":help listchars") This has been crucial in debugging really strange issues students manage to create.
- andreareina 6y agoOne of the strange things I've encountered is bare \r (i.e. no accompanying \n) in the middle of a line from a windows-sourced file. Don't know how they got there, just that redshift didn't like it one bit.
- bear8642 6y agoodd Windows gave you that - believe \r was Mac's standard at one point…
- tcoff91 6y agoI think how it happens with windows is one windows editor adds \r\n and then the file is edited in an editor that isn't properly aware of the windows line ending and the \n gets deleted. I've seen this happen before. It's especially likely to happen if the file has mixed line endings.
- Anarch157a 6y agoI had a problem like this at work just before Xmas break. A script wa returning "command not found" for 'chmod' because of an invisible Unicode character. The guy who asked my help refused to believe it, untill I showed him a hex dump of the script, he got convinced when he saw 2 byted between the command and parameters.
- dan-robertson 6y agoIt’s quite a common problem with pasting commands from emails (or I guess some other webpages.) Two spaces when writing an email get converted into at least 1 non-breaking space and these make bash sad. Unfortunately there isn’t really a good way to have bash treat them as white space which is annoying.
- rzzzt 6y agoFor me, Bash scripts with CRLF line endings sometimes just exit without doing anything. A quick dos2unix later they are running perfectly.
- mdpye 6y agoI believe it's also Option-Space on a Mac, which one my old colleagues would manage fairly regularly while typing at speed...
- boogies 6y agoCompose Space Space on Free OSes. It’s useful sometimes, though I wish there was a default binding for zero-width space — I resorted to a non-breaking one to unbreak a link followed by an apostrophe yesterday.