I'm thinking of adding an escape mechanism to be able to format wide
strings a bit better. Right now there's the choice between sprintf %s
which just let wide chars straight through, and %O which quotes them
along with all other control chars. Neither is really good if you want
to e.g. print a string to stdout which possibly can contain some wide
chars.
For that I'd like to add a %S that only quotes wide chars in some way.
The question is what quoting method to use. Java and many other
languages has one with "\u" which always is followed by four
hexadecimal digits. (Java doesn't say anything about chars wider than
16 bits, but I guess it's "\U" followed by eight hexadecimal digits,
as in some generic Unicode technical papers.)
Java also specifies a way to keep it unambiguous: If a string already
contains a sequence like "\u4711" it's quoted by inserting another
"u", i.e. it becomes "\uu4711".
The \u and \U scheme is better than the \4711 and \x9c9 escapes that
Pike uses in strings since there's no ambiguity where the escape
sequence ends (%O uses tricks like "\4322""33" to cope with them but
that doesn't work very well in strings without quotes around them).
The ad-hoc quoting scheme "<nnnnn>" used in some places in
describe_svalue would also be replaced by this for consistency.