* xmlGetEncodingAlias: * @alias: the alias name as parsed, in UTF-8 format (ASCII actually) * * Lookup an encoding name for the given alias. * * Returns NULL if not found, otherwise the original name */
| 955 | * Returns NULL if not found, otherwise the original name |
| 956 | */ |
| 957 | const char * |
| 958 | xmlGetEncodingAlias(const char *alias) { |
| 959 | int i; |
| 960 | char upper[100]; |
| 961 | |
| 962 | if (alias == NULL) |
| 963 | return(NULL); |
| 964 | |
| 965 | if (xmlCharEncodingAliases == NULL) |
| 966 | return(NULL); |
| 967 | |
| 968 | for (i = 0;i < 99;i++) { |
| 969 | upper[i] = toupper(alias[i]); |
| 970 | if (upper[i] == 0) break; |
| 971 | } |
| 972 | upper[i] = 0; |
| 973 | |
| 974 | /* |
| 975 | * Walk down the list looking for a definition of the alias |
| 976 | */ |
| 977 | for (i = 0;i < xmlCharEncodingAliasesNb;i++) { |
| 978 | if (!strcmp(xmlCharEncodingAliases[i].alias, upper)) { |
| 979 | return(xmlCharEncodingAliases[i].name); |
| 980 | } |
| 981 | } |
| 982 | return(NULL); |
| 983 | } |
| 984 | |
| 985 | /** |
| 986 | * xmlAddEncodingAlias: |
no outgoing calls