Logo Search packages:      
Sourcecode: kmess version File versions  Download package

QString & KMessShared::htmlEscape ( QString &  string  )  [static]

Converts a string with HTML to one with escaped entities

Only the main HTML control characters are escaped; the string is made suitable for insertion within an HTML tag attribute. Neither KDE nor Qt have escape/unescape methods this thorough, they only replace the <>&. Annoying.

string The string to modify
A reference to the modified string

Definition at line 315 of file kmessshared.cpp.

Referenced by AddressBookService::contactUpdate(), Emoticon::getHtml(), OfflineImService::getMessage(), htmlEscape(), OfflineImService::OfflineImService(), OldRichTextParser::parseMsnString(), RichTextParser::parseMsnString(), PassportLoginService::requestMultipleSecurityTokens(), EmoticonTheme::saveTheme(), and EmoticonTheme::updateCache().

  string.replace( ";", "&#59;" )
        .replace( "&", "&amp;" )
        .replace( "&amp;#59;", "&#59;" ) // oh god :(
        .replace( "<", "&lt;"  )
        .replace( ">", "&gt;"  )
        .replace( "'", "&#39;" )
        .replace( '"', "&#34;" );  // NOTE: by not using &quot; this result is also usable for XML.

  return string;

Generated by  Doxygen 1.6.0   Back to index