本文整理汇总了C++中TextEncoding::decode方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEncoding::decode方法的具体用法?C++ TextEncoding::decode怎么用?C++ TextEncoding::decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEncoding
的用法示例。
在下文中一共展示了TextEncoding::decode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: decodeURL
static String decodeURL(const String& string, const TextEncoding& encoding)
{
String workingString = string;
workingString.replace('+', ' ');
workingString = decodeURLEscapeSequences(workingString);
CString workingStringUTF8 = workingString.utf8();
String decodedString = encoding.decode(workingStringUTF8.data(), workingStringUTF8.length());
// FIXME: Is this check necessary?
if (decodedString.isEmpty())
return canonicalize(workingString);
return canonicalize(decodedString);
}
示例2: decodeURL
String XSSAuditor::decodeURL(const String& string, const TextEncoding& encoding, bool decodeEntities, bool decodeURLEscapeSequencesTwice)
{
String result;
String url = string;
url.replace('+', ' ');
result = decodeURLEscapeSequences(url);
CString utf8Url = result.utf8();
String decodedResult = encoding.decode(utf8Url.data(), utf8Url.length());
if (!decodedResult.isEmpty())
result = decodedResult;
if (decodeURLEscapeSequencesTwice) {
result = decodeURLEscapeSequences(result);
utf8Url = result.utf8();
decodedResult = encoding.decode(utf8Url.data(), utf8Url.length());
if (!decodedResult.isEmpty())
result = decodedResult;
}
if (decodeEntities)
result = decodeHTMLEntities(result);
return result;
}