MCPcopy Create free account
hub / github.com/Kitware/VTK / htmlCheckEncoding

Function htmlCheckEncoding

ThirdParty/libxml2/vtklibxml2/HTMLparser.c:3675–3699  ·  view source on GitHub ↗

* htmlCheckEncoding: * @ctxt: an HTML parser context * @attvalue: the attribute value * * Checks an http-equiv attribute from a Meta tag to detect * the encoding * If a new encoding is detected the parser is switched to decode * it and pass UTF8 */

Source from the content-addressed store, hash-verified

3673 * it and pass UTF8
3674 */
3675static void
3676htmlCheckEncoding(htmlParserCtxtPtr ctxt, const xmlChar *attvalue) {
3677 const xmlChar *encoding;
3678 xmlChar *copy;
3679
3680 if (!attvalue)
3681 return;
3682
3683 encoding = xmlStrcasestr(attvalue, BAD_CAST"charset");
3684 if (encoding != NULL) {
3685 encoding += 7;
3686 }
3687 /*
3688 * skip blank
3689 */
3690 if (encoding && IS_BLANK_CH(*encoding))
3691 encoding = xmlStrcasestr(attvalue, BAD_CAST"=");
3692 if (encoding && *encoding == '=') {
3693 encoding ++;
3694 copy = xmlStrdup(encoding);
3695 if (copy == NULL)
3696 htmlErrMemory(ctxt);
3697 xmlSetDeclaredEncoding(ctxt, copy);
3698 }
3699}
3700
3701/**
3702 * htmlCheckMeta:

Callers 1

htmlCheckMetaFunction · 0.85

Calls 4

xmlStrcasestrFunction · 0.85
xmlStrdupFunction · 0.85
htmlErrMemoryFunction · 0.85
xmlSetDeclaredEncodingFunction · 0.85

Tested by

no test coverage detected