On 2015-07-28 04:29, Andreas Aardal Hanssen wrote:
> Isn't this needless convenience? Yet another environment variable that
> needs documenting? If you want to inspect the contents of a QString, can't
> you just add the suitable escape code to your own code? Forcing
> qPrintable() or qUtf8Printable() on everyone who wants to keep human
> readable debug output sounds pretty evil, but having e.g. toHtmlEscaped()
> or a similar function doing the octa/hex thing could be better.

While I'm generally trying to stay out of this debate, I'd like to toss
in that a QString → QString or QString → QByteArray function that
converts from "raw" to either C-style escaped or HTML-style escaped (or
for bonus points, both), AND BACK AGAIN, would be useful in other contexts.

(For instance, I recently needed to write a new file format that is
SSV-like but needs to contain user supplied strings. In order to make
tokenizing not incredibly painful, it was decided to HTML-escape the
strings so that they would not contain spaces or strange unprintable
characters. I've also written C-style escaping functions more than once,
especially for encoding and decoding quoted strings with escaped
embedded quotes and so forth.)

-- 
Matthew

_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to