[Development] Prettier printing of Unicode strings

Knoll Lars Lars.Knoll at digia.com
Sun Jan 26 21:17:20 CET 2014


On 26/01/14 20:39, "Thiago Macieira" <thiago.macieira at intel.com> wrote:

>On domingo, 26 de janeiro de 2014 12:36:27, Jan Kundrát wrote:
>> On Tuesday, 21 January 2014 01:05:07 CEST, Thiago Macieira wrote:
>> >    Actual   (s) : \u221212\u20A0\uD800\uDC00
>> >    Expected (s2): \u221212\u20AC\uD800\uDC00
>> 
>> [...]
>> 
>> >  - all backslashes as \\
>> >  - the following characters as their escape sequences: \r, \n, \t,
>>\b, \f
>> >  - all other control characters (including 0x7f) as \u00XX
>> >  - all other characters with \uXXXX, including text otherwise

I usually prefer the output in utf8, as it gives readable strings (at
least on Mac and Linux as long as you don¹t mess with the locale). Escaped
strings are much more tedious to debug for me in most cases. So I¹d like
to ask for at least an option to get utf8 strings as output, and only
escape non printable chars.

Cheers,
Lars


>> > 
>> > readable in the
>> > 
>> >    terminal in the locale
>> 
>> The rules you describe appear to be out-of-sync with what the example
>>above
>> shows. Is there perhaps a rule "English letters, punctuation and numbers
>> are displayed as-is"?
>
>I failed to exclude ASCII 0x20 to 0x7f (except the backslash) in "all
>other 
>characters"
>
>> If that is the case, then it looks like a good change.
>> 
>> > Should I also do the same for QByteArray? Reading hex dumps isn't very
>> 
>> nice.
>> 
>> Yes -- I have used QString::fromUtf8(bytearray) multiple times in my
>>tests
>> to produce an ugly workaround.
>
>Done.
>-- 
>Thiago Macieira - thiago.macieira (AT) intel.com
>  Software Architect - Intel Open Source Technology Center




More information about the Development mailing list