3 ms·
QSN: A Familiar String Interchange Format (2020)
- remram 5y ago> 'mu = \u{03bc}' # char escapes are encoded in UTF-8 That's not UTF-8, that's Unicode. The equivalent UTF-8 is '\xCE\xBC'. Is that what it's supposed to expand to?
- chubot 5y agoYes that's fair -- I changed the doc for the next release. All 3 encodings are valid -- literal UTF-8 bytes, hex escapes for bytes, or unicode escape.
- jepler 5y agoCareful, qsn is different than single quoted strings in sh.
- chubot 5y ago(author here) Yes, one option I've thought about adding is the optional $ on the front, so these mean the same thing: '\n' # QSN string $'\n' # emphasize that this is a QSN string, not something else # note that $'' comes from shell, but isn't literally shell It feels like the $ is too annoying to require everywhere. - But we don't want to use "" because it can be confused for JSON. - And '' means something different in Python, coreutils output, shell, JavaScript, etc. So there aren't many other options. $'' can be for cases where it's possible the string will be confused with some other format. (It's also true that QSN isn't identical to shell strings, there is a subset property)