I've been thinking a bit about how to succinctly produce quoted
strings of various formats from pike code, and sprintf("%O", s) used
to be fairly close to the answer in 7.6, but used octal escapes with
two " marks afterward, if the following character was a number, which
got fixed in 7.7 via \uXXXX quotes instead. In 7.7, however, now any
occurrence of \n gets turned into the five characters '\\', 'n', '"',
'\n', '"', which again is just as bad as 7.6 was with octal numbers.
I don't care much for the argument that %O is only intended for debug
purposes, as long as there is no equally succinct way of producing the
kind of quoted strings for log files, consumption of other languages
and the like you typically want quoted strings for in the first place;
the functionality ought to be somewhere (not necessarily sprintf %O,
even though I would personally find that awfully convenient), and it
should be terse.
Opinions, ideas, wishes? Can Locale.Charset easily be abused to
produce a codec that would work in 7.6 and 7.7 alike and turn \n and
similar C shorthands into two-byte sequences and escape above-ASCII as
\uXXXX?