[Qt-interest] URL encoding only non-printing characters

Bob Hood bhood2 at comcast.net
Wed Apr 7 19:13:19 CEST 2010


I'm displaying string values a QListView.  These string values can
contain anything, but in particular, non-printing characters within the
string cause the grief with the display; e.g., a carriage-return
character will cause the display of the string to end abruptly at the
point where it appears.

Although these strings are not URLs, I have encoded the string using
QUrl::toPercentEncoding(), and that "normalizes" it so that it displays
completely (albiet with URL-encoded percent values) in the QListView. 
However, I would rather encode only non-printing characters.  Others,
like "?" or "{", are fine for my purposes.

Would anybody have an idea how I could specify non-printing characters
(line-feed, tab, etc.) in the combination of toPercentEncoding()'s
"include" and "exclude" settings such that only those values are percent
encoded?




More information about the Qt-interest-old mailing list