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

Function xmlOpenCharEncodingHandler

ThirdParty/libxml2/vtklibxml2/encoding.c:1934–1975  ·  view source on GitHub ↗

* xmlOpenCharEncodingHandler: * @name: a string describing the char encoding. * @output: boolean, use handler for output * @out: pointer to result * * Find or create a handler matching the encoding. If no default or * registered handler could be found, try to create a handler using * iconv or ICU if supported. * * The handler must be closed with xmlCharEncCloseFunc. * * If the encodi

Source from the content-addressed store, hash-verified

1932 * Returns an xmlParserErrors error code.
1933 */
1934int
1935xmlOpenCharEncodingHandler(const char *name, int output,
1936 xmlCharEncodingHandler **out) {
1937 const char *nalias;
1938 const char *norig;
1939 xmlCharEncoding enc;
1940 int ret;
1941
1942 if (out == NULL)
1943 return(XML_ERR_ARGUMENT);
1944 *out = NULL;
1945
1946 if (name == NULL)
1947 return(XML_ERR_ARGUMENT);
1948
1949 if ((xmlStrcasecmp(BAD_CAST name, BAD_CAST "UTF-8") == 0) ||
1950 (xmlStrcasecmp(BAD_CAST name, BAD_CAST "UTF8") == 0))
1951 return(XML_ERR_OK);
1952
1953 /*
1954 * Do the alias resolution
1955 */
1956 norig = name;
1957 nalias = xmlGetEncodingAlias(name);
1958 if (nalias != NULL)
1959 name = nalias;
1960
1961 ret = xmlFindHandler(name, output, out);
1962 if (*out != NULL)
1963 return(0);
1964 if (ret != XML_ERR_UNSUPPORTED_ENCODING)
1965 return(ret);
1966
1967 /*
1968 * Fallback using the canonical names
1969 *
1970 * TODO: We should make sure that the name of the returned
1971 * handler equals norig.
1972 */
1973 enc = xmlParseCharEncoding(norig);
1974 return(xmlLookupCharEncodingHandler(enc, out));
1975}
1976
1977/**
1978 * xmlFindCharEncodingHandler:

Callers 11

xmlDetectEBCDICFunction · 0.85
xmlSetDeclaredEncodingFunction · 0.85
htmlFindOutputEncoderFunction · 0.85
xmlNewSaveCtxtFunction · 0.85
xmlSaveSwitchEncodingFunction · 0.85
xmlDocFormatDumpFunction · 0.85
xmlSaveFormatFileEncFunction · 0.85
xmlXIncludeLoadTxtFunction · 0.85

Calls 4

xmlGetEncodingAliasFunction · 0.85
xmlFindHandlerFunction · 0.85
xmlParseCharEncodingFunction · 0.85

Tested by

no test coverage detected