Nobuyoshi Nakada wrote:
> Hi,
> 
> At Sat, 27 Oct 2007 05:18:33 +0900,
> David Flanagan wrote in [ruby-core:12980]:
>> In a related matter, Should String.inspect be modified to support \u 
>> escapes?  Perhaps when the primary encoding is not unicode it should do 
>> this?
> 
> \x for other encodings?  It means rb_encoding has to know which
> escape to be used.
> 

Hmm.  I assumed that it would be the inspect method that generated the 
escapes, not the encoding objects. But yes, I was being Unicode-centric, 
since that is the only encoding we're considering a special escape for...

I guess this is an issue even in the absence of a \u escape.  Suppose 
I'm running with a primary encoding of ASCII, but I create a binary 
string and force its encoding to SJIS.  Then I call the inspect method 
of that SJIS encoding. Does it escape the multi-byte characters of the 
string?  Does it escape the bytes that correspond to non-printing ASCII 
characters because the primary encoding is ASCII, or does it leave them 
unescaped because the string's encoding is SJIS.

	David