* 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 */
| 3673 | * it and pass UTF8 |
| 3674 | */ |
| 3675 | static void |
| 3676 | htmlCheckEncoding(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: |
no test coverage detected