From: David Flanagan Date: 2007-10-29T16:59:17+09:00 Subject: Re: \u escapes in string literals: proof of concept implementation Nobuyoshi Nakada wrote: > Hi, > > At Mon, 29 Oct 2007 14:11:45 +0900, > David Flanagan wrote in [ruby-core:13032]: >>>> 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... > > Instead, how about to use \x for all encodings, with making > \x{...} to represent codepoint? > So if the string encoding is different from the primary encoding, and the string contains codepoints > 255, then inspect will dump those codepoints using \x{} escapes? I'm okay with that. I'd prefer, however, if the output of inspect was a valid Ruby string literal suitable to pass to eval(). David