* xmlGetActualEncoding: * @ctxt: the parser context * * Returns the actual used to parse the document. This can differ from * the declared encoding. */
| 1469 | * the declared encoding. |
| 1470 | */ |
| 1471 | const xmlChar * |
| 1472 | xmlGetActualEncoding(xmlParserCtxtPtr ctxt) { |
| 1473 | const xmlChar *encoding = NULL; |
| 1474 | |
| 1475 | if ((ctxt->input->flags & XML_INPUT_USES_ENC_DECL) || |
| 1476 | (ctxt->input->flags & XML_INPUT_AUTO_ENCODING)) { |
| 1477 | /* Preserve encoding exactly */ |
| 1478 | encoding = ctxt->encoding; |
| 1479 | } else if ((ctxt->input->buf) && (ctxt->input->buf->encoder)) { |
| 1480 | encoding = BAD_CAST ctxt->input->buf->encoder->name; |
| 1481 | } else if (ctxt->input->flags & XML_INPUT_HAS_ENCODING) { |
| 1482 | encoding = BAD_CAST "UTF-8"; |
| 1483 | } |
| 1484 | |
| 1485 | return(encoding); |
| 1486 | } |
| 1487 | |
| 1488 | /************************************************************************ |
| 1489 | * * |
no outgoing calls
no test coverage detected