3 ms·
Special quotation marks sometimes end up in filenames (usually when I have saved a web page) and I hate trying to tab-complete or write globs for those. Of cour
by 1313ed01 7mo ago
Special quotation marks sometimes end up in filenames (usually when I have saved a web page) and I hate trying to tab-complete or write globs for those. Of course it is equally annoying with other random unicode characters not present on my keyboard, but it mostly happens with quotation marks. (Yes, the solution is to copy-paste those characters in the terminal, but that is the annoying part, having to do that instead of just typing the next character).
- black_knight 7mo agoThis problem was solved by Plan 9 (roughly 1990) where there was a compose key to turn sequences into Unicode characters. Say compose-f-a to get ∀. This was all configurable in /lib/keyboard. On so-called modern X11 or Wayland based systems (Linux or *BSD), there is a similar feature called XCompose. Worse syntax, but still functional.
- zahlman 7mo agoBeing able to configure your system to type the characters really doesn't solve the problem. In particular, if you get data (including metadata such as filenames) from someone else, you need to recognize the characters, both to do the configuration and then actually type them. And characters are not glyphs. There are all kinds of cases where simply looking at something doesn't and can't tell you what characters are in it.
- black_knight 7mo agoPlan 9 also came with a utility command called “unicode” which helps analyse Unicode strings (get code point etc). Elegant weapons of a more civilised age…
- JNRowe 7mo agoThere is a portable unicode¹ tool available, and it is packaged in a bunch of distributions. I'll spare us the full output, but "unicode a→z" produces something like: U+0061 LATIN SMALL LETTER A UTF-8: 61 UTF-16BE: 0061 Decimal: a Octal: \0141 a (A) Uppercase: 0041 Category: Ll (Letter, Lowercase); East Asian width: Na (narrow) Unicode block: 0000..007F; Basic Latin Bidi: L (Left-to-Right) Age: Assigned as of Unicode 1.1.0 (June, 1993) … U+2192 RIGHTWARDS ARROW … U+007A LATIN SMALL LETTER Z ¹ https://github.com/garabik/unicode https://github.com/garabik/unicode
- 1313ed01 7mo agoEmacs has a built-in M-x describe-char that prints out similar information and also this useful tip: to input: type "C-x 8 RET 2192" or "C-x 8 RET RIGHTWARDS ARROW" However in the case of trying to type the name of a file in a shell, that has some weird unicode character in it, just copying the character is faster than to first identify it and then use some clever trick to type it. It can be useful to know for some small number of weird symbols how to insert them, or to use C-x 8 RET (followed by TAB-completion) to find symbols, but I almost always stick to what is available on my keyboard, and often only a small ASCII subset of that, to keep things simple.
- zahlman 7mo agoSure, but how do you point that at the filename you don't know how to type?
- vincent-manis 7mo agoAnd just to point out that there is WinCompose, for Windows, and a somewhat janky but usable solution using Karabiner Elements and macos-compose for Mac.