Lines Matching refs:encoding
79 const xmlChar *encoding;
131 msg = "unknown encoding %s\n";
196 * encoding specified.
333 if ((ctxt->encoding == NULL) && (ctxt->escape == NULL))
361 if (ctxt->encoding != NULL)
362 xmlFree((char *) ctxt->encoding);
376 xmlNewSaveCtxt(const char *encoding, int options)
387 if (encoding != NULL) {
388 ret->handler = xmlFindCharEncodingHandler(encoding);
390 xmlSaveErr(XML_SAVE_UNKNOWN_ENCODING, NULL, encoding);
394 ret->encoding = xmlStrdup((const xmlChar *)encoding);
460 static int xmlSaveSwitchEncoding(xmlSaveCtxtPtr ctxt, const char *encoding) {
463 if ((encoding != NULL) && (buf->encoder == NULL) && (buf->conv == NULL)) {
464 buf->encoder = xmlFindCharEncodingHandler((const char *)encoding);
467 (const char *)encoding);
473 xmlSaveErrMemory("creating encoding buffer");
631 * @encoding: an optional encoding string
685 const xmlChar *oldctxtenc = ctxt->encoding;
686 const xmlChar *encoding = ctxt->encoding;
695 oldenc = doc->encoding;
696 if (ctxt->encoding != NULL) {
697 doc->encoding = BAD_CAST ctxt->encoding;
698 } else if (doc->encoding != NULL) {
699 encoding = doc->encoding;
703 if ((encoding != NULL) && (doc != NULL))
704 htmlSetMetaEncoding(doc, (const xmlChar *) encoding);
705 if ((encoding == NULL) && (doc != NULL))
706 encoding = htmlGetMetaEncoding(doc);
707 if (encoding == NULL)
708 encoding = BAD_CAST "HTML";
709 if ((encoding != NULL) && (oldctxtenc == NULL) &&
711 if (xmlSaveSwitchEncoding(ctxt, (const char*) encoding) < 0) {
712 doc->encoding = oldenc;
719 (const char *)encoding, 1);
722 (const char *)encoding, 0);
730 doc->encoding = oldenc;
938 const xmlChar *oldenc = cur->encoding;
939 const xmlChar *oldctxtenc = ctxt->encoding;
940 const xmlChar *encoding = ctxt->encoding;
953 if (ctxt->encoding != NULL) {
954 cur->encoding = BAD_CAST ctxt->encoding;
955 } else if (cur->encoding != NULL) {
956 encoding = cur->encoding;
958 encoding = (const xmlChar *)
967 if (encoding != NULL)
968 htmlSetMetaEncoding(cur, (const xmlChar *) encoding);
969 if (encoding == NULL)
970 encoding = htmlGetMetaEncoding(cur);
971 if (encoding == NULL)
972 encoding = BAD_CAST "HTML";
973 if ((encoding != NULL) && (oldctxtenc == NULL) &&
975 if (xmlSaveSwitchEncoding(ctxt, (const char*) encoding) < 0) {
976 cur->encoding = oldenc;
983 (const char *)encoding, 1);
986 (const char *)encoding, 0);
987 if (ctxt->encoding != NULL)
988 cur->encoding = oldenc;
996 enc = xmlParseCharEncoding((const char*) encoding);
997 if ((encoding != NULL) && (oldctxtenc == NULL) &&
1004 * we need to switch to this encoding but just for this
1008 if (xmlSaveSwitchEncoding(ctxt, (const char*) encoding) < 0) {
1009 cur->encoding = oldenc;
1030 if (encoding != NULL) {
1031 xmlOutputBufferWrite(buf, 10, " encoding=");
1032 xmlBufferWriteQuotedString(buf->buffer, (xmlChar *) encoding);
1081 cur->encoding = oldenc;
1245 * @encoding: an optional encoding string
1279 * @encoding: an optional encoding string
1471 if (ctxt->encoding) {
1472 xmlOutputBufferWriteString(buf, (const char *)ctxt->encoding);
1506 if (ctxt->encoding) {
1507 xmlOutputBufferWriteString(buf, (const char *)ctxt->encoding);
1624 * @encoding: the encoding name to use or NULL
1628 * with the encoding and the options given.
1633 xmlSaveToFd(int fd, const char *encoding, int options)
1637 ret = xmlNewSaveCtxt(encoding, options);
1650 * @encoding: the encoding name to use or NULL
1654 * to an URL (but this is less reliable) with the encoding and the options
1660 xmlSaveToFilename(const char *filename, const char *encoding, int options)
1665 ret = xmlNewSaveCtxt(encoding, options);
1679 * @encoding: the encoding name to use or NULL
1683 * with the encoding and the options given
1689 xmlSaveToBuffer(xmlBufferPtr buffer, const char *encoding, int options)
1695 ret = xmlNewSaveCtxt(encoding, options);
1698 if (encoding != NULL) {
1699 handler = xmlFindCharEncodingHandler(encoding);
1722 * @encoding: the encoding name to use or NULL
1726 * with the encoding and the options given
1733 void *ioctx, const char *encoding, int options)
1737 ret = xmlNewSaveCtxt(encoding, options);
1928 (doc->encoding == NULL))) {
1940 doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
1971 doc->encoding = xmlStrdup(BAD_CAST "ISO-8859-1");
2109 * @encoding: an optional encoding string
2117 int level, int format, const char *encoding)
2129 if (encoding == NULL)
2130 encoding = "UTF-8";
2137 ctxt.encoding = (const xmlChar *) encoding;
2161 * @txt_encoding: Character encoding to use when generating XML text
2164 * Dump the current DOM tree into memory using the character encoding specified
2198 * Validate the encoding value, if provided.
2203 txt_encoding = (const char *) out_doc->encoding;
2223 ctxt.encoding = (const xmlChar *) txt_encoding;
2284 * @txt_encoding: Character encoding to use when generating XML text
2286 * Dump the current DOM tree into memory using the character encoding specified
2314 const char * encoding;
2325 encoding = (const char *) cur->encoding;
2327 if (encoding != NULL) {
2328 handler = xmlFindCharEncodingHandler(encoding);
2330 xmlFree((char *) cur->encoding);
2331 cur->encoding = NULL;
2332 encoding = NULL;
2342 ctxt.encoding = (const xmlChar *) encoding;
2369 * @encoding: the encoding if any assuming the I/O layer handles the trancoding
2378 xmlSaveFileTo(xmlOutputBufferPtr buf, xmlDocPtr cur, const char *encoding) {
2392 ctxt.encoding = (const xmlChar *) encoding;
2404 * @encoding: the encoding if any assuming the I/O layer handles the trancoding
2415 const char *encoding, int format)
2432 ctxt.encoding = (const xmlChar *) encoding;
2444 * @encoding: the name of the encoding to use or NULL.
2455 const char * encoding, int format ) {
2464 if (encoding == NULL)
2465 encoding = (const char *) cur->encoding;
2467 if (encoding != NULL) {
2469 handler = xmlFindCharEncodingHandler(encoding);
2487 ctxt.encoding = (const xmlChar *) encoding;
2502 * @encoding: the name of an encoding (or NULL)
2504 * Dump an XML document, converting it to the given encoding
2509 xmlSaveFileEnc(const char *filename, xmlDocPtr cur, const char *encoding) {
2510 return ( xmlSaveFormatFileEnc( filename, cur, encoding, 0 ) );