From f954bd4990c6de595d94e415a2f04ba62e7a3d92 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 27 Dec 2008 06:56:45 +0100 Subject: [PATCH] bump simplepie to 1.1.3 --- simplepie/simplepie.inc | 2800 ++++++++++++++++++++++----------------- 1 file changed, 1576 insertions(+), 1224 deletions(-) diff --git a/simplepie/simplepie.inc b/simplepie/simplepie.inc index cc3987c0..8c995bcf 100644 --- a/simplepie/simplepie.inc +++ b/simplepie/simplepie.inc @@ -33,7 +33,7 @@ * POSSIBILITY OF SUCH DAMAGE. * * @package SimplePie - * @version 1.1.1 + * @version 1.1.3 * @copyright 2004-2008 Ryan Parman, Geoffrey Sneddon * @author Ryan Parman * @author Geoffrey Sneddon @@ -51,14 +51,12 @@ define('SIMPLEPIE_NAME', 'SimplePie'); /** * SimplePie Version */ -define('SIMPLEPIE_VERSION', '1.1.1'); +define('SIMPLEPIE_VERSION', '1.1.3'); /** * SimplePie Build - * @todo Hardcode for release (there's no need to have to call SimplePie_Misc::parse_date() only every load of simplepie.inc) */ -define('SIMPLEPIE_BUILD', 20080315205903); -//define('SIMPLEPIE_BUILD', gmdate('YmdHis', SimplePie_Misc::parse_date(substr('$Date: 2008-03-15 15:28:23 -0700 (Sat, 15 Mar 2008) $', 7, 25)) ? SimplePie_Misc::parse_date(substr('$Date: 2008-03-15 15:28:23 -0700 (Sat, 15 Mar 2008) $', 7, 25)) : filemtime(__FILE__))); +define('SIMPLEPIE_BUILD', 20081219); /** * SimplePie Website URL @@ -288,6 +286,12 @@ define('SIMPLEPIE_NAMESPACE_RSS_10', 'http://purl.org/rss/1.0/'); */ define('SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT', 'http://purl.org/rss/1.0/modules/content/'); +/** + * RSS 2.0 Namespace + * (Stupid, I know, but I'm certain it will confuse people less with support.) + */ +define('SIMPLEPIE_NAMESPACE_RSS_20', ''); + /** * DC 1.0 Namespace */ @@ -741,7 +745,7 @@ class SimplePie { return md5(serialize($this->data)); } - + /** * Remove items that link back to this before destroying this object */ @@ -764,7 +768,7 @@ class SimplePie unset($this->data['ordered_items']); } } - + /** * Force the given data/URL to be treated as a feed no matter what it * appears like @@ -1686,7 +1690,7 @@ function embed_wmedia(width, height, link) { { $data = $this->raw_data; } - + // Set up array of possible encodings $encodings = array(); @@ -1695,10 +1699,10 @@ function embed_wmedia(width, height, link) { { $encodings[] = $this->input_encoding; } - + $application_types = array('application/xml', 'application/xml-dtd', 'application/xml-external-parsed-entity'); $text_types = array('text/xml', 'text/xml-external-parsed-entity'); - + // RFC 3023 (only applies to sniffed content) if (isset($sniffed)) { @@ -1725,15 +1729,15 @@ function embed_wmedia(width, height, link) { $encodings[] = 'US-ASCII'; } } - + // Fallback to XML 1.0 Appendix F.1/UTF-8/ISO-8859-1 $encodings = array_merge($encodings, SimplePie_Misc::xml_encoding($data)); $encodings[] = 'UTF-8'; $encodings[] = 'ISO-8859-1'; - + // There's no point in trying an encoding twice $encodings = array_unique($encodings); - + // If we want the XML, just output that with the most likely encoding and quit if ($this->xml_dump) { @@ -1741,40 +1745,41 @@ function embed_wmedia(width, height, link) { echo $data; exit; } - + // Loop through each possible encoding, till we return something, or run out of possibilities foreach ($encodings as $encoding) { // Change the encoding to UTF-8 (as we always use UTF-8 internally) - $utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8'); - - // Create new parser - $parser =& new $this->parser_class(); - - // If it's parsed fine - if ($parser->parse($utf8_data, 'UTF-8')) + if ($utf8_data = SimplePie_Misc::change_encoding($data, $encoding, 'UTF-8')) { - $this->data = $parser->get_data(); - if (isset($this->data['child'])) + // Create new parser + $parser =& new $this->parser_class(); + + // If it's parsed fine + if ($parser->parse($utf8_data, 'UTF-8')) { - if (isset($headers)) + $this->data = $parser->get_data(); + if ($this->get_type() & ~SIMPLEPIE_TYPE_NONE) { - $this->data['headers'] = $headers; + if (isset($headers)) + { + $this->data['headers'] = $headers; + } + $this->data['build'] = SIMPLEPIE_BUILD; + + // Cache the file if caching is enabled + if ($cache && !$cache->save($this)) + { + trigger_error("$cache->name is not writeable", E_USER_WARNING); + } + return true; } - $this->data['build'] = SIMPLEPIE_BUILD; - - // Cache the file if caching is enabled - if ($cache && !$cache->save($this)) + else { - trigger_error("$cache->name is not writeable", E_USER_WARNING); + $this->error = "A feed could not be found at $this->feed_url"; + SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); + return false; } - return true; - } - else - { - $this->error = "A feed could not be found at $this->feed_url"; - SimplePie_Misc::error($this->error, E_USER_NOTICE, __FILE__, __LINE__); - return false; } } } @@ -3071,7 +3076,7 @@ class SimplePie_Item { return md5(serialize($this->data)); } - + /** * Remove items that link back to this before destroying this object */ @@ -5547,7 +5552,7 @@ class SimplePie_Item return null; } } - + function get_source() { if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source')) @@ -5676,7 +5681,7 @@ class SimplePie_Source { return md5(serialize($this->data)); } - + /** * Remove items that link back to this before destroying this object */ @@ -7104,7 +7109,7 @@ class SimplePie_Enclosure // Mime-types by handler. $types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash - $types_fmedia = array('video/flv', 'video/x-flv'); // Flash Media Player + $types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player $types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime $types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media $types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3 @@ -7700,9 +7705,9 @@ class SimplePie_File $out = "GET $get HTTP/1.0\r\n"; $out .= "Host: $url_parts[host]\r\n"; $out .= "User-Agent: $useragent\r\n"; - if (function_exists('gzinflate')) + if (extension_loaded('zlib')) { - $out .= "Accept-Encoding: gzip,deflate\r\n"; + $out .= "Accept-Encoding: x-gzip,gzip,deflate\r\n"; } if (isset($url_parts['user']) && isset($url_parts['pass'])) @@ -7738,13 +7743,41 @@ class SimplePie_File $location = SimplePie_Misc::absolutize_url($this->headers['location'], $url); return $this->SimplePie_File($location, $timeout, $redirects, $headers, $useragent, $force_fsockopen); } - if (isset($this->headers['content-encoding']) && ($this->headers['content-encoding'] == 'gzip' || $this->headers['content-encoding'] == 'deflate')) + if (isset($this->headers['content-encoding'])) { - if (substr($this->body, 0, 8) == "\x1f\x8b\x08\x00\x00\x00\x00\x00") + // Hey, we act dumb elsewhere, so let's do that here too + switch (strtolower(trim($this->headers['content-encoding'], "\x09\x0A\x0D\x20"))) { - $this->body = substr($this->body, 10); + case 'gzip': + case 'x-gzip': + $decoder = new SimplePie_gzdecode($this->body); + if (!$decoder->parse()) + { + $this->error = 'Unable to decode HTTP "gzip" stream'; + $this->success = false; + } + else + { + $this->body = $decoder->data; + } + break; + + case 'deflate': + if (($body = gzuncompress($this->body)) === false) + { + if (($body = gzinflate($this->body)) === false) + { + $this->error = 'Unable to decode HTTP "deflate" stream'; + $this->success = false; + } + } + $this->body = $body; + break; + + default: + $this->error = 'Unknown content coding'; + $this->success = false; } - $this->body = gzinflate($this->body); } } } @@ -8199,6 +8232,316 @@ class SimplePie_HTTP_Parser } } +/** + * gzdecode + * + * @package SimplePie + */ +class SimplePie_gzdecode +{ + /** + * Compressed data + * + * @access private + * @see gzdecode::$data + */ + var $compressed_data; + + /** + * Size of compressed data + * + * @access private + */ + var $compressed_size; + + /** + * Minimum size of a valid gzip string + * + * @access private + */ + var $min_compressed_size = 18; + + /** + * Current position of pointer + * + * @access private + */ + var $position = 0; + + /** + * Flags (FLG) + * + * @access private + */ + var $flags; + + /** + * Uncompressed data + * + * @access public + * @see gzdecode::$compressed_data + */ + var $data; + + /** + * Modified time + * + * @access public + */ + var $MTIME; + + /** + * Extra Flags + * + * @access public + */ + var $XFL; + + /** + * Operating System + * + * @access public + */ + var $OS; + + /** + * Subfield ID 1 + * + * @access public + * @see gzdecode::$extra_field + * @see gzdecode::$SI2 + */ + var $SI1; + + /** + * Subfield ID 2 + * + * @access public + * @see gzdecode::$extra_field + * @see gzdecode::$SI1 + */ + var $SI2; + + /** + * Extra field content + * + * @access public + * @see gzdecode::$SI1 + * @see gzdecode::$SI2 + */ + var $extra_field; + + /** + * Original filename + * + * @access public + */ + var $filename; + + /** + * Human readable comment + * + * @access public + */ + var $comment; + + /** + * Don't allow anything to be set + * + * @access public + */ + function __set($name, $value) + { + trigger_error("Cannot write property $name", E_USER_ERROR); + } + + /** + * Set the compressed string and related properties + * + * @access public + */ + function SimplePie_gzdecode($data) + { + $this->compressed_data = $data; + $this->compressed_size = strlen($data); + } + + /** + * Decode the GZIP stream + * + * @access public + */ + function parse() + { + if ($this->compressed_size >= $this->min_compressed_size) + { + // Check ID1, ID2, and CM + if (substr($this->compressed_data, 0, 3) !== "\x1F\x8B\x08") + { + return false; + } + + // Get the FLG (FLaGs) + $this->flags = ord($this->compressed_data[3]); + + // FLG bits above (1 << 4) are reserved + if ($this->flags > 0x1F) + { + return false; + } + + // Advance the pointer after the above + $this->position += 4; + + // MTIME + $mtime = substr($this->compressed_data, $this->position, 4); + // Reverse the string if we're on a big-endian arch because l is the only signed long and is machine endianness + if (current(unpack('S', "\x00\x01")) === 1) + { + $mtime = strrev($mtime); + } + $this->MTIME = current(unpack('l', $mtime)); + $this->position += 4; + + // Get the XFL (eXtra FLags) + $this->XFL = ord($this->compressed_data[$this->position++]); + + // Get the OS (Operating System) + $this->OS = ord($this->compressed_data[$this->position++]); + + // Parse the FEXTRA + if ($this->flags & 4) + { + // Read subfield IDs + $this->SI1 = $this->compressed_data[$this->position++]; + $this->SI2 = $this->compressed_data[$this->position++]; + + // SI2 set to zero is reserved for future use + if ($this->SI2 === "\x00") + { + return false; + } + + // Get the length of the extra field + $len = current(unpack('v', substr($this->compressed_data, $this->position, 2))); + $position += 2; + + // Check the length of the string is still valid + $this->min_compressed_size += $len + 4; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Set the extra field to the given data + $this->extra_field = substr($this->compressed_data, $this->position, $len); + $this->position += $len; + } + else + { + return false; + } + } + + // Parse the FNAME + if ($this->flags & 8) + { + // Get the length of the filename + $len = strspn($this->compressed_data, "\x00", $this->position); + + // Check the length of the string is still valid + $this->min_compressed_size += $len + 1; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Set the original filename to the given string + $this->filename = substr($this->compressed_data, $this->position, $len); + $this->position += $len + 1; + } + else + { + return false; + } + } + + // Parse the FCOMMENT + if ($this->flags & 16) + { + // Get the length of the comment + $len = strspn($this->compressed_data, "\x00", $this->position); + + // Check the length of the string is still valid + $this->min_compressed_size += $len + 1; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Set the original comment to the given string + $this->comment = substr($this->compressed_data, $this->position, $len); + $this->position += $len + 1; + } + else + { + return false; + } + } + + // Parse the FHCRC + if ($this->flags & 2) + { + // Check the length of the string is still valid + $this->min_compressed_size += $len + 2; + if ($this->compressed_size >= $this->min_compressed_size) + { + // Read the CRC + $crc = current(unpack('v', substr($this->compressed_data, $this->position, 2))); + + // Check the CRC matches + if ((crc32(substr($this->compressed_data, 0, $this->position)) & 0xFFFF) === $crc) + { + $this->position += 2; + } + else + { + return false; + } + } + else + { + return false; + } + } + + // Decompress the actual data + if (($this->data = gzinflate(substr($this->compressed_data, $this->position, -8))) === false) + { + return false; + } + else + { + $this->position = $this->compressed_size - 8; + } + + // Check CRC of data + $crc = current(unpack('V', substr($this->compressed_data, $this->position, 4))); + $this->position += 4; + /*if (extension_loaded('hash') && sprintf('%u', current(unpack('V', hash('crc32b', $this->data)))) !== sprintf('%u', $crc)) + { + return false; + }*/ + + // Check ISIZE of data + $isize = current(unpack('V', substr($this->compressed_data, $this->position, 4))); + $this->position += 4; + if (sprintf('%u', strlen($this->data) & 0xFFFFFFFF) !== sprintf('%u', $isize)) + { + return false; + } + + // Wow, against all odds, we've actually got a valid gzip string + return true; + } + else + { + return false; + } + } +} + class SimplePie_Cache { /** @@ -8720,7 +9063,7 @@ class SimplePie_Misc return ''; } } - + /** * Converts a Windows-1252 encoded string to a UTF-8 encoded string * @@ -8732,7 +9075,7 @@ class SimplePie_Misc function windows_1252_to_utf8($string) { static $convert_table = array("\x80" => "\xE2\x82\xAC", "\x81" => "\xEF\xBF\xBD", "\x82" => "\xE2\x80\x9A", "\x83" => "\xC6\x92", "\x84" => "\xE2\x80\x9E", "\x85" => "\xE2\x80\xA6", "\x86" => "\xE2\x80\xA0", "\x87" => "\xE2\x80\xA1", "\x88" => "\xCB\x86", "\x89" => "\xE2\x80\xB0", "\x8A" => "\xC5\xA0", "\x8B" => "\xE2\x80\xB9", "\x8C" => "\xC5\x92", "\x8D" => "\xEF\xBF\xBD", "\x8E" => "\xC5\xBD", "\x8F" => "\xEF\xBF\xBD", "\x90" => "\xEF\xBF\xBD", "\x91" => "\xE2\x80\x98", "\x92" => "\xE2\x80\x99", "\x93" => "\xE2\x80\x9C", "\x94" => "\xE2\x80\x9D", "\x95" => "\xE2\x80\xA2", "\x96" => "\xE2\x80\x93", "\x97" => "\xE2\x80\x94", "\x98" => "\xCB\x9C", "\x99" => "\xE2\x84\xA2", "\x9A" => "\xC5\xA1", "\x9B" => "\xE2\x80\xBA", "\x9C" => "\xC5\x93", "\x9D" => "\xEF\xBF\xBD", "\x9E" => "\xC5\xBE", "\x9F" => "\xC5\xB8", "\xA0" => "\xC2\xA0", "\xA1" => "\xC2\xA1", "\xA2" => "\xC2\xA2", "\xA3" => "\xC2\xA3", "\xA4" => "\xC2\xA4", "\xA5" => "\xC2\xA5", "\xA6" => "\xC2\xA6", "\xA7" => "\xC2\xA7", "\xA8" => "\xC2\xA8", "\xA9" => "\xC2\xA9", "\xAA" => "\xC2\xAA", "\xAB" => "\xC2\xAB", "\xAC" => "\xC2\xAC", "\xAD" => "\xC2\xAD", "\xAE" => "\xC2\xAE", "\xAF" => "\xC2\xAF", "\xB0" => "\xC2\xB0", "\xB1" => "\xC2\xB1", "\xB2" => "\xC2\xB2", "\xB3" => "\xC2\xB3", "\xB4" => "\xC2\xB4", "\xB5" => "\xC2\xB5", "\xB6" => "\xC2\xB6", "\xB7" => "\xC2\xB7", "\xB8" => "\xC2\xB8", "\xB9" => "\xC2\xB9", "\xBA" => "\xC2\xBA", "\xBB" => "\xC2\xBB", "\xBC" => "\xC2\xBC", "\xBD" => "\xC2\xBD", "\xBE" => "\xC2\xBE", "\xBF" => "\xC2\xBF", "\xC0" => "\xC3\x80", "\xC1" => "\xC3\x81", "\xC2" => "\xC3\x82", "\xC3" => "\xC3\x83", "\xC4" => "\xC3\x84", "\xC5" => "\xC3\x85", "\xC6" => "\xC3\x86", "\xC7" => "\xC3\x87", "\xC8" => "\xC3\x88", "\xC9" => "\xC3\x89", "\xCA" => "\xC3\x8A", "\xCB" => "\xC3\x8B", "\xCC" => "\xC3\x8C", "\xCD" => "\xC3\x8D", "\xCE" => "\xC3\x8E", "\xCF" => "\xC3\x8F", "\xD0" => "\xC3\x90", "\xD1" => "\xC3\x91", "\xD2" => "\xC3\x92", "\xD3" => "\xC3\x93", "\xD4" => "\xC3\x94", "\xD5" => "\xC3\x95", "\xD6" => "\xC3\x96", "\xD7" => "\xC3\x97", "\xD8" => "\xC3\x98", "\xD9" => "\xC3\x99", "\xDA" => "\xC3\x9A", "\xDB" => "\xC3\x9B", "\xDC" => "\xC3\x9C", "\xDD" => "\xC3\x9D", "\xDE" => "\xC3\x9E", "\xDF" => "\xC3\x9F", "\xE0" => "\xC3\xA0", "\xE1" => "\xC3\xA1", "\xE2" => "\xC3\xA2", "\xE3" => "\xC3\xA3", "\xE4" => "\xC3\xA4", "\xE5" => "\xC3\xA5", "\xE6" => "\xC3\xA6", "\xE7" => "\xC3\xA7", "\xE8" => "\xC3\xA8", "\xE9" => "\xC3\xA9", "\xEA" => "\xC3\xAA", "\xEB" => "\xC3\xAB", "\xEC" => "\xC3\xAC", "\xED" => "\xC3\xAD", "\xEE" => "\xC3\xAE", "\xEF" => "\xC3\xAF", "\xF0" => "\xC3\xB0", "\xF1" => "\xC3\xB1", "\xF2" => "\xC3\xB2", "\xF3" => "\xC3\xB3", "\xF4" => "\xC3\xB4", "\xF5" => "\xC3\xB5", "\xF6" => "\xC3\xB6", "\xF7" => "\xC3\xB7", "\xF8" => "\xC3\xB8", "\xF9" => "\xC3\xB9", "\xFA" => "\xC3\xBA", "\xFB" => "\xC3\xBB", "\xFC" => "\xC3\xBC", "\xFD" => "\xC3\xBD", "\xFE" => "\xC3\xBE", "\xFF" => "\xC3\xBF"); - + return strtr($string, $convert_table); } @@ -8740,7 +9083,7 @@ class SimplePie_Misc { $input = SimplePie_Misc::encoding($input); $output = SimplePie_Misc::encoding($output); - + // We fail to fail on non US-ASCII bytes if ($input === 'US-ASCII') { @@ -8755,1362 +9098,1368 @@ class SimplePie_Misc $data = substr($data, 0, strcspn($data, $non_ascii_octects)); } - if (function_exists('iconv') && ($return = @iconv($input, $output, $data))) + // This is first, as behaviour of this is completely predictable + if ($input === 'Windows-1252' && $output === 'UTF-8') { - return $return; + return SimplePie_Misc::windows_1252_to_utf8($data); } + // This is second, as behaviour of this varies only with PHP version elseif (function_exists('mb_convert_encoding') && ($return = @mb_convert_encoding($data, $output, $input))) { return $return; } - elseif ($input == 'windows-1252' && $output == 'UTF-8') + // This is last, as behaviour of this varies with OS userland and PHP version + elseif (function_exists('iconv') && ($return = @iconv($input, $output, $data))) { - return SimplePie_Misc::windows_1252_to_utf8($data); + return $return; } - elseif ($input == 'UTF-8' && $output == 'windows-1252') + // If we can't do anything, just fail + else { - return utf8_decode($data); + return false; } - return $data; } - function encoding($encoding) + function encoding($charset) { - // Character sets are case-insensitive (though we'll return them in the form given in their registration) - switch (strtoupper($encoding)) + /* Character sets are case-insensitive, and also need some further + normalization in the real world (though we'll return them in the form given + in their registration). */ + switch (strtolower(preg_replace('/[\x09-\x0D\x20-\x2F\x3A-\x40\x5B-\x60\x7B-\x7E]/', '', $charset))) { - case 'ANSI_X3.110-1983': - case 'CSA_T500-1983': - case 'CSISO99NAPLPS': - case 'ISO-IR-99': - case 'NAPLPS': - return 'ANSI_X3.110-1983'; - - case 'ARABIC7': - case 'ASMO_449': - case 'CSISO89ASMO449': - case 'ISO-IR-89': - case 'ISO_9036': - return 'ASMO_449'; - - case 'ADOBE-STANDARD-ENCODING': - case 'CSADOBESTANDARDENCODING': + case 'adobestandardencoding': + case 'csadobestandardencoding': return 'Adobe-Standard-Encoding'; - - case 'ADOBE-SYMBOL-ENCODING': - case 'CSHPPSMATH': + + case 'adobesymbolencoding': + case 'cshppsmath': return 'Adobe-Symbol-Encoding'; - - case 'AMI-1251': - case 'AMI1251': - case 'AMIGA-1251': - case 'AMIGA1251': + + case 'ami1251': + case 'ami1251': + case 'amiga1251': + case 'amiga1251': return 'Amiga-1251'; - - case 'BOCU-1': - case 'CSBOCU-1': + + case 'ansix31101983': + case 'csat5001983': + case 'csiso99naplps': + case 'isoir99': + case 'naplps': + return 'ANSI_X3.110-1983'; + + case 'arabic7': + case 'asmo449': + case 'csiso89asmo449': + case 'isoir89': + case 'iso9036': + return 'ASMO_449'; + + case 'big5': + case 'csbig5': + case 'xxbig5': + return 'Big5'; + + case 'big5hkscs': + return 'Big5-HKSCS'; + + case 'bocu1': + case 'csbocu1': return 'BOCU-1'; - - case 'BRF': - case 'CSBRF': + + case 'brf': + case 'csbrf': return 'BRF'; - - case 'BS_4730': - case 'CSISO4UNITEDKINGDOM': - case 'GB': - case 'ISO-IR-4': - case 'ISO646-GB': - case 'UK': + + case 'bs4730': + case 'csiso4unitedkingdom': + case 'gb': + case 'isoir4': + case 'iso646gb': + case 'uk': return 'BS_4730'; - - case 'BS_VIEWDATA': - case 'CSISO47BSVIEWDATA': - case 'ISO-IR-47': + + case 'bsviewdata': + case 'csiso47bsviewdata': + case 'isoir47': return 'BS_viewdata'; - - case 'BIG5': - case 'CSBIG5': - return 'Big5'; - - case 'BIG5-HKSCS': - return 'Big5-HKSCS'; - - case 'CESU-8': - case 'CSCESU-8': + + case 'cesu8': + case 'cscesu8': return 'CESU-8'; - - case 'CA': - case 'CSA7-1': - case 'CSA_Z243.4-1985-1': - case 'CSISO121CANADIAN1': - case 'ISO-IR-121': - case 'ISO646-CA': + + case 'ca': + case 'csa71': + case 'csaz243419851': + case 'csiso121canadian1': + case 'isoir121': + case 'iso646ca': return 'CSA_Z243.4-1985-1'; - - case 'CSA7-2': - case 'CSA_Z243.4-1985-2': - case 'CSISO122CANADIAN2': - case 'ISO-IR-122': - case 'ISO646-CA2': + + case 'csa72': + case 'csaz243419852': + case 'csiso122canadian2': + case 'isoir122': + case 'iso646ca2': return 'CSA_Z243.4-1985-2'; - - case 'CSA_Z243.4-1985-GR': - case 'CSISO123CSAZ24341985GR': - case 'ISO-IR-123': + + case 'csaz24341985gr': + case 'csiso123csaz24341985gr': + case 'isoir123': return 'CSA_Z243.4-1985-gr'; - - case 'CSISO139CSN369103': - case 'CSN_369103': - case 'ISO-IR-139': + + case 'csiso139csn369103': + case 'csn369103': + case 'isoir139': return 'CSN_369103'; - - case 'CSDECMCS': - case 'DEC': - case 'DEC-MCS': + + case 'csdecmcs': + case 'dec': + case 'decmcs': return 'DEC-MCS'; - - case 'CSISO21GERMAN': - case 'DE': - case 'DIN_66003': - case 'ISO-IR-21': - case 'ISO646-DE': + + case 'csiso21german': + case 'de': + case 'din66003': + case 'isoir21': + case 'iso646de': return 'DIN_66003'; - - case 'CSISO646DANISH': - case 'DK': - case 'DS2089': - case 'DS_2089': - case 'ISO646-DK': - return 'DS_2089'; - - case 'CSIBMEBCDICATDE': - case 'EBCDIC-AT-DE': - return 'EBCDIC-AT-DE'; - - case 'CSEBCDICATDEA': - case 'EBCDIC-AT-DE-A': + + case 'csdkus': + case 'dkus': + return 'dk-us'; + + case 'csiso646danish': + case 'dk': + case 'ds2089': + case 'ds2089': + case 'iso646dk': + return 'DS_2089'; + + case 'csibmebcdicatde': + case 'ebcdicatde': + return 'EBCDIC-AT-DE'; + + case 'csebcdicatdea': + case 'ebcdicatdea': return 'EBCDIC-AT-DE-A'; - - case 'CSEBCDICCAFR': - case 'EBCDIC-CA-FR': + + case 'csebcdiccafr': + case 'ebcdiccafr': return 'EBCDIC-CA-FR'; - - case 'CSEBCDICDKNO': - case 'EBCDIC-DK-NO': + + case 'csebcdicdkno': + case 'ebcdicdkno': return 'EBCDIC-DK-NO'; - - case 'CSEBCDICDKNOA': - case 'EBCDIC-DK-NO-A': + + case 'csebcdicdknoa': + case 'ebcdicdknoa': return 'EBCDIC-DK-NO-A'; - - case 'CSEBCDICES': - case 'EBCDIC-ES': + + case 'csebcdices': + case 'ebcdices': return 'EBCDIC-ES'; - - case 'CSEBCDICESA': - case 'EBCDIC-ES-A': + + case 'csebcdicesa': + case 'ebcdicesa': return 'EBCDIC-ES-A'; - - case 'CSEBCDICESS': - case 'EBCDIC-ES-S': + + case 'csebcdicess': + case 'ebcdicess': return 'EBCDIC-ES-S'; - - case 'CSEBCDICFISE': - case 'EBCDIC-FI-SE': + + case 'csebcdicfise': + case 'ebcdicfise': return 'EBCDIC-FI-SE'; - - case 'CSEBCDICFISEA': - case 'EBCDIC-FI-SE-A': + + case 'csebcdicfisea': + case 'ebcdicfisea': return 'EBCDIC-FI-SE-A'; - - case 'CSEBCDICFR': - case 'EBCDIC-FR': + + case 'csebcdicfr': + case 'ebcdicfr': return 'EBCDIC-FR'; - - case 'CSEBCDICIT': - case 'EBCDIC-IT': + + case 'csebcdicit': + case 'ebcdicit': return 'EBCDIC-IT'; - - case 'CSEBCDICPT': - case 'EBCDIC-PT': + + case 'csebcdicpt': + case 'ebcdicpt': return 'EBCDIC-PT'; - - case 'CSEBCDICUK': - case 'EBCDIC-UK': + + case 'csebcdicuk': + case 'ebcdicuk': return 'EBCDIC-UK'; - - case 'CSEBCDICUS': - case 'EBCDIC-US': + + case 'csebcdicus': + case 'ebcdicus': return 'EBCDIC-US'; - - case 'CSISO111ECMACYRILLIC': - case 'ECMA-CYRILLIC': - case 'ISO-IR-111': - case 'KOI8-E': + + case 'csiso111ecmacyrillic': + case 'ecmacyrillic': + case 'isoir111': + case 'koi8e': return 'ECMA-cyrillic'; - - case 'CSISO17SPANISH': - case 'ES': - case 'ISO-IR-17': - case 'ISO646-ES': + + case 'csiso17spanish': + case 'es': + case 'isoir17': + case 'iso646es': return 'ES'; - - case 'CSISO85SPANISH2': - case 'ES2': - case 'ISO-IR-85': - case 'ISO646-ES2': + + case 'csiso85spanish2': + case 'es2': + case 'isoir85': + case 'iso646es2': return 'ES2'; - - case 'CSEUCPKDFMTJAPANESE': - case 'EUC-JP': - case 'EXTENDED_UNIX_CODE_PACKED_FORMAT_FOR_JAPANESE': - return 'EUC-JP'; - - case 'CSEUCKR': - case 'EUC-KR': - return 'EUC-KR'; - - case 'CSEUCFIXWIDJAPANESE': - case 'EXTENDED_UNIX_CODE_FIXED_WIDTH_FOR_JAPANESE': + + case 'cseucfixwidjapanese': + case 'extendedunixcodefixedwidthforjapanese': return 'Extended_UNIX_Code_Fixed_Width_for_Japanese'; - - case 'GB18030': + + case 'cseucpkdfmtjapanese': + case 'eucjp': + case 'extendedunixcodepackedformatforjapanese': + return 'Extended_UNIX_Code_Packed_Format_for_Japanese'; + + case 'gb18030': return 'GB18030'; - - case 'CSGB2312': - case 'GB2312': - return 'GB2312'; - - case 'CP936': - case 'GBK': - case 'MS936': - case 'WINDOWS-936': + + case 'cp936': + case 'gbk': + case 'ms936': + case 'windows936': + case 'csgb2312': + case 'gb2312': + case 'chinese': + case 'csiso58gb231280': + case 'gb231280': + case 'isoir58': return 'GBK'; - - case 'CN': - case 'CSISO57GB1988': - case 'GB_1988-80': - case 'ISO-IR-57': - case 'ISO646-CN': + + case 'cn': + case 'csiso57gb1988': + case 'gb198880': + case 'isoir57': + case 'iso646cn': return 'GB_1988-80'; - - case 'CHINESE': - case 'CSISO58GB231280': - case 'GB_2312-80': - case 'ISO-IR-58': - return 'GB_2312-80'; - - case 'CSISO153GOST1976874': - case 'GOST_19768-74': - case 'ISO-IR-153': - case 'ST_SEV_358-88': + + case 'csiso153gost1976874': + case 'gost1976874': + case 'isoir153': + case 'stsev35888': return 'GOST_19768-74'; - - case 'CSHPDESKTOP': - case 'HP-DESKTOP': + + case 'csiso150': + case 'csiso150greekccitt': + case 'greekccitt': + case 'isoir150': + return 'greek-ccitt'; + + case 'csiso88greek7': + case 'greek7': + case 'isoir88': + return 'greek7'; + + case 'csiso18greek7old': + case 'greek7old': + case 'isoir18': + return 'greek7-old'; + + case 'cshpdesktop': + case 'hpdesktop': return 'HP-DeskTop'; - - case 'CSHPLEGAL': - case 'HP-LEGAL': + + case 'cshplegal': + case 'hplegal': return 'HP-Legal'; - - case 'CSHPMATH8': - case 'HP-MATH8': + + case 'cshpmath8': + case 'hpmath8': return 'HP-Math8'; - - case 'CSHPPIFONT': - case 'HP-PI-FONT': + + case 'cshppifont': + case 'hppifont': return 'HP-Pi-font'; - - case 'HZ-GB-2312': + + case 'cshproman8': + case 'hproman8': + case 'r8': + case 'roman8': + return 'hp-roman8'; + + case 'hzgb2312': return 'HZ-GB-2312'; - - case 'CSIBMSYMBOLS': - case 'IBM-SYMBOLS': + + case 'csibmsymbols': + case 'ibmsymbols': return 'IBM-Symbols'; - - case 'CSIBMTHAI': - case 'IBM-THAI': + + case 'csibmthai': + case 'ibmthai': return 'IBM-Thai'; - - case 'CCSID00858': - case 'CP00858': - case 'IBM00858': - case 'PC-MULTILINGUAL-850+EURO': + + case 'ccsid00858': + case 'cp00858': + case 'ibm00858': + case 'pcmultilingual850euro': return 'IBM00858'; - - case 'CCSID00924': - case 'CP00924': - case 'EBCDIC-LATIN9--EURO': - case 'IBM00924': + + case 'ccsid00924': + case 'cp00924': + case 'ebcdiclatin9euro': + case 'ibm00924': return 'IBM00924'; - - case 'CCSID01140': - case 'CP01140': - case 'EBCDIC-US-37+EURO': - case 'IBM01140': + + case 'ccsid01140': + case 'cp01140': + case 'ebcdicus37euro': + case 'ibm01140': return 'IBM01140'; - - case 'CCSID01141': - case 'CP01141': - case 'EBCDIC-DE-273+EURO': - case 'IBM01141': + + case 'ccsid01141': + case 'cp01141': + case 'ebcdicde273euro': + case 'ibm01141': return 'IBM01141'; - - case 'CCSID01142': - case 'CP01142': - case 'EBCDIC-DK-277+EURO': - case 'EBCDIC-NO-277+EURO': - case 'IBM01142': + + case 'ccsid01142': + case 'cp01142': + case 'ebcdicdk277euro': + case 'ebcdicno277euro': + case 'ibm01142': return 'IBM01142'; - - case 'CCSID01143': - case 'CP01143': - case 'EBCDIC-FI-278+EURO': - case 'EBCDIC-SE-278+EURO': - case 'IBM01143': + + case 'ccsid01143': + case 'cp01143': + case 'ebcdicfi278euro': + case 'ebcdicse278euro': + case 'ibm01143': return 'IBM01143'; - - case 'CCSID01144': - case 'CP01144': - case 'EBCDIC-IT-280+EURO': - case 'IBM01144': + + case 'ccsid01144': + case 'cp01144': + case 'ebcdicit280euro': + case 'ibm01144': return 'IBM01144'; - - case 'CCSID01145': - case 'CP01145': - case 'EBCDIC-ES-284+EURO': - case 'IBM01145': + + case 'ccsid01145': + case 'cp01145': + case 'ebcdices284euro': + case 'ibm01145': return 'IBM01145'; - - case 'CCSID01146': - case 'CP01146': - case 'EBCDIC-GB-285+EURO': - case 'IBM01146': + + case 'ccsid01146': + case 'cp01146': + case 'ebcdicgb285euro': + case 'ibm01146': return 'IBM01146'; - - case 'CCSID01147': - case 'CP01147': - case 'EBCDIC-FR-297+EURO': - case 'IBM01147': + + case 'ccsid01147': + case 'cp01147': + case 'ebcdicfr297euro': + case 'ibm01147': return 'IBM01147'; - - case 'CCSID01148': - case 'CP01148': - case 'EBCDIC-INTERNATIONAL-500+EURO': - case 'IBM01148': + + case 'ccsid01148': + case 'cp01148': + case 'ebcdicinternational500euro': + case 'ibm01148': return 'IBM01148'; - - case 'CCSID01149': - case 'CP01149': - case 'EBCDIC-IS-871+EURO': - case 'IBM01149': + + case 'ccsid01149': + case 'cp01149': + case 'ebcdicis871euro': + case 'ibm01149': return 'IBM01149'; - - case 'CP037': - case 'CSIBM037': - case 'EBCDIC-CP-CA': - case 'EBCDIC-CP-NL': - case 'EBCDIC-CP-US': - case 'EBCDIC-CP-WT': - case 'IBM037': + + case 'cp037': + case 'csibm037': + case 'ebcdiccpca': + case 'ebcdiccpnl': + case 'ebcdiccpus': + case 'ebcdiccpwt': + case 'ibm037': return 'IBM037'; - - case 'CP038': - case 'CSIBM038': - case 'EBCDIC-INT': - case 'IBM038': + + case 'cp038': + case 'csibm038': + case 'ebcdicint': + case 'ibm038': return 'IBM038'; - - case 'CP1026': - case 'CSIBM1026': - case 'IBM1026': - return 'IBM1026'; - - case 'IBM-1047': - case 'IBM1047': - return 'IBM1047'; - - case 'CP273': - case 'CSIBM273': - case 'IBM273': + + case 'cp273': + case 'csibm273': + case 'ibm273': return 'IBM273'; - - case 'CP274': - case 'CSIBM274': - case 'EBCDIC-BE': - case 'IBM274': + + case 'cp274': + case 'csibm274': + case 'ebcdicbe': + case 'ibm274': return 'IBM274'; - - case 'CP275': - case 'CSIBM275': - case 'EBCDIC-BR': - case 'IBM275': + + case 'cp275': + case 'csibm275': + case 'ebcdicbr': + case 'ibm275': return 'IBM275'; - - case 'CSIBM277': - case 'EBCDIC-CP-DK': - case 'EBCDIC-CP-NO': - case 'IBM277': + + case 'csibm277': + case 'ebcdiccpdk': + case 'ebcdiccpno': + case 'ibm277': return 'IBM277'; - - case 'CP278': - case 'CSIBM278': - case 'EBCDIC-CP-FI': - case 'EBCDIC-CP-SE': - case 'IBM278': + + case 'cp278': + case 'csibm278': + case 'ebcdiccpfi': + case 'ebcdiccpse': + case 'ibm278': return 'IBM278'; - - case 'CP280': - case 'CSIBM280': - case 'EBCDIC-CP-IT': - case 'IBM280': + + case 'cp280': + case 'csibm280': + case 'ebcdiccpit': + case 'ibm280': return 'IBM280'; - - case 'CP281': - case 'CSIBM281': - case 'EBCDIC-JP-E': - case 'IBM281': + + case 'cp281': + case 'csibm281': + case 'ebcdicjpe': + case 'ibm281': return 'IBM281'; - - case 'CP284': - case 'CSIBM284': - case 'EBCDIC-CP-ES': - case 'IBM284': + + case 'cp284': + case 'csibm284': + case 'ebcdiccpes': + case 'ibm284': return 'IBM284'; - - case 'CP285': - case 'CSIBM285': - case 'EBCDIC-CP-GB': - case 'IBM285': + + case 'cp285': + case 'csibm285': + case 'ebcdiccpgb': + case 'ibm285': return 'IBM285'; - - case 'CP290': - case 'CSIBM290': - case 'EBCDIC-JP-KANA': - case 'IBM290': + + case 'cp290': + case 'csibm290': + case 'ebcdicjpkana': + case 'ibm290': return 'IBM290'; - - case 'CP297': - case 'CSIBM297': - case 'EBCDIC-CP-FR': - case 'IBM297': + + case 'cp297': + case 'csibm297': + case 'ebcdiccpfr': + case 'ibm297': return 'IBM297'; - - case 'CP420': - case 'CSIBM420': - case 'EBCDIC-CP-AR1': - case 'IBM420': + + case 'cp420': + case 'csibm420': + case 'ebcdiccpar1': + case 'ibm420': return 'IBM420'; - - case 'CP423': - case 'CSIBM423': - case 'EBCDIC-CP-GR': - case 'IBM423': + + case 'cp423': + case 'csibm423': + case 'ebcdiccpgr': + case 'ibm423': return 'IBM423'; - - case 'CP424': - case 'CSIBM424': - case 'EBCDIC-CP-HE': - case 'IBM424': + + case 'cp424': + case 'csibm424': + case 'ebcdiccphe': + case 'ibm424': return 'IBM424'; - + case '437': - case 'CP437': - case 'CSPC8CODEPAGE437': - case 'IBM437': + case 'cp437': + case 'cspc8codepage437': + case 'ibm437': return 'IBM437'; - - case 'CP500': - case 'CSIBM500': - case 'EBCDIC-CP-BE': - case 'EBCDIC-CP-CH': - case 'IBM500': + + case 'cp500': + case 'csibm500': + case 'ebcdiccpbe': + case 'ebcdiccpch': + case 'ibm500': return 'IBM500'; - - case 'CP775': - case 'CSPC775BALTIC': - case 'IBM775': + + case 'cp775': + case 'cspc775baltic': + case 'ibm775': return 'IBM775'; - + case '850': - case 'CP850': - case 'CSPC850MULTILINGUAL': - case 'IBM850': + case 'cp850': + case 'cspc850multilingual': + case 'ibm850': return 'IBM850'; - + case '851': - case 'CP851': - case 'CSIBM851': - case 'IBM851': + case 'cp851': + case 'csibm851': + case 'ibm851': return 'IBM851'; - + case '852': - case 'CP852': - case 'CSPCP852': - case 'IBM852': + case 'cp852': + case 'cspcp852': + case 'ibm852': return 'IBM852'; - + case '855': - case 'CP855': - case 'CSIBM855': - case 'IBM855': + case 'cp855': + case 'csibm855': + case 'ibm855': return 'IBM855'; - + case '857': - case 'CP857': - case 'CSIBM857': - case 'IBM857': + case 'cp857': + case 'csibm857': + case 'ibm857': return 'IBM857'; - + case '860': - case 'CP860': - case 'CSIBM860': - case 'IBM860': + case 'cp860': + case 'csibm860': + case 'ibm860': return 'IBM860'; - + case '861': - case 'CP-IS': - case 'CP861': - case 'CSIBM861': - case 'IBM861': + case 'cpis': + case 'cp861': + case 'csibm861': + case 'ibm861': return 'IBM861'; - + case '862': - case 'CP862': - case 'CSPC862LATINHEBREW': - case 'IBM862': + case 'cp862': + case 'cspc862latinhebrew': + case 'ibm862': return 'IBM862'; - + case '863': - case 'CP863': - case 'CSIBM863': - case 'IBM863': + case 'cp863': + case 'csibm863': + case 'ibm863': return 'IBM863'; - - case 'CP864': - case 'CSIBM864': - case 'IBM864': + + case 'cp864': + case 'csibm864': + case 'ibm864': return 'IBM864'; - + case '865': - case 'CP865': - case 'CSIBM865': - case 'IBM865': + case 'cp865': + case 'csibm865': + case 'ibm865': return 'IBM865'; - + case '866': - case 'CP866': - case 'CSIBM866': - case 'IBM866': + case 'cp866': + case 'csibm866': + case 'ibm866': return 'IBM866'; - - case 'CP-AR': - case 'CP868': - case 'CSIBM868': - case 'IBM868': + + case 'cpar': + case 'cp868': + case 'csibm868': + case 'ibm868': return 'IBM868'; - + case '869': - case 'CP-GR': - case 'CP869': - case 'CSIBM869': - case 'IBM869': + case 'cpgr': + case 'cp869': + case 'csibm869': + case 'ibm869': return 'IBM869'; - - case 'CP870': - case 'CSIBM870': - case 'EBCDIC-CP-ROECE': - case 'EBCDIC-CP-YU': - case 'IBM870': + + case 'cp870': + case 'csibm870': + case 'ebcdiccproece': + case 'ebcdiccpyu': + case 'ibm870': return 'IBM870'; - - case 'CP871': - case 'CSIBM871': - case 'EBCDIC-CP-IS': - case 'IBM871': + + case 'cp871': + case 'csibm871': + case 'ebcdiccpis': + case 'ibm871': return 'IBM871'; - - case 'CP880': - case 'CSIBM880': - case 'EBCDIC-CYRILLIC': - case 'IBM880': + + case 'cp880': + case 'csibm880': + case 'ebcdiccyrillic': + case 'ibm880': return 'IBM880'; - - case 'CP891': - case 'CSIBM891': - case 'IBM891': + + case 'cp891': + case 'csibm891': + case 'ibm891': return 'IBM891'; - - case 'CP903': - case 'CSIBM903': - case 'IBM903': + + case 'cp903': + case 'csibm903': + case 'ibm903': return 'IBM903'; - + case '904': - case 'CP904': - case 'CSIBBM904': - case 'IBM904': + case 'cp904': + case 'csibbm904': + case 'ibm904': return 'IBM904'; - - case 'CP905': - case 'CSIBM905': - case 'EBCDIC-CP-TR': - case 'IBM905': + + case 'cp905': + case 'csibm905': + case 'ebcdiccptr': + case 'ibm905': return 'IBM905'; - - case 'CP918': - case 'CSIBM918': - case 'EBCDIC-CP-AR2': - case 'IBM918': + + case 'cp918': + case 'csibm918': + case 'ebcdiccpar2': + case 'ibm918': return 'IBM918'; - - case 'CSISO143IECP271': - case 'IEC_P27-1': - case 'ISO-IR-143': + + case 'cp1026': + case 'csibm1026': + case 'ibm1026': + return 'IBM1026'; + + case 'ibm1047': + case 'ibm1047': + return 'IBM1047'; + + case 'csiso143iecp271': + case 'iecp271': + case 'isoir143': return 'IEC_P27-1'; - - case 'CSISO49INIS': - case 'INIS': - case 'ISO-IR-49': + + case 'csiso49inis': + case 'inis': + case 'isoir49': return 'INIS'; - - case 'CSISO50INIS8': - case 'INIS-8': - case 'ISO-IR-50': + + case 'csiso50inis8': + case 'inis8': + case 'isoir50': return 'INIS-8'; - - case 'CSISO51INISCYRILLIC': - case 'INIS-CYRILLIC': - case 'ISO-IR-51': + + case 'csiso51iniscyrillic': + case 'iniscyrillic': + case 'isoir51': return 'INIS-cyrillic'; - - case 'CSINVARIANT': - case 'INVARIANT': + + case 'csinvariant': + case 'invariant': return 'INVARIANT'; - - case 'ISO-10646-J-1': - return 'ISO-10646-J-1'; - - case 'CSUNICODE': - case 'ISO-10646-UCS-2': - return 'ISO-10646-UCS-2'; - - case 'CSUCS4': - case 'ISO-10646-UCS-4': - return 'ISO-10646-UCS-4'; - - case 'CSUNICODEASCII': - case 'ISO-10646-UCS-BASIC': - return 'ISO-10646-UCS-Basic'; - - case 'CSISO10646UTF1': - case 'ISO-10646-UTF-1': - return 'ISO-10646-UTF-1'; - - case 'CSUNICODELATIN1': - case 'ISO-10646': - case 'ISO-10646-UNICODE-LATIN1': - return 'ISO-10646-Unicode-Latin1'; - - case 'CSISO115481': - case 'ISO-11548-1': - case 'ISO_11548-1': - case 'ISO_TR_11548-1': - return 'ISO-11548-1'; - - case 'ISO-2022-CN': + + case 'iso2022cn': return 'ISO-2022-CN'; - - case 'ISO-2022-CN-EXT': + + case 'iso2022cnext': return 'ISO-2022-CN-EXT'; - - case 'CSISO2022JP': - case 'ISO-2022-JP': + + case 'csiso2022jp': + case 'iso2022jp': return 'ISO-2022-JP'; - - case 'CSISO2022JP2': - case 'ISO-2022-JP-2': + + case 'csiso2022jp2': + case 'iso2022jp2': return 'ISO-2022-JP-2'; - - case 'CSISO2022KR': - case 'ISO-2022-KR': + + case 'csiso2022kr': + case 'iso2022kr': return 'ISO-2022-KR'; - - case 'CSWINDOWS30LATIN1': - case 'ISO-8859-1-WINDOWS-3.0-LATIN-1': + + case 'cswindows30latin1': + case 'iso88591windows30latin1': return 'ISO-8859-1-Windows-3.0-Latin-1'; - - case 'CSWINDOWS31LATIN1': - case 'ISO-8859-1-WINDOWS-3.1-LATIN-1': + + case 'cswindows31latin1': + case 'iso88591windows31latin1': return 'ISO-8859-1-Windows-3.1-Latin-1'; - - case 'CSISOLATIN6': - case 'ISO-8859-10': - case 'ISO-IR-157': - case 'ISO_8859-10:1992': - case 'L6': - case 'LATIN6': - return 'ISO-8859-10'; - - case 'ISO-8859-13': - return 'ISO-8859-13'; - - case 'ISO-8859-14': - case 'ISO-CELTIC': - case 'ISO-IR-199': - case 'ISO_8859-14': - case 'ISO_8859-14:1998': - case 'L8': - case 'LATIN8': - return 'ISO-8859-14'; - - case 'ISO-8859-15': - case 'ISO_8859-15': - case 'LATIN-9': - return 'ISO-8859-15'; - - case 'ISO-8859-16': - case 'ISO-IR-226': - case 'ISO_8859-16': - case 'ISO_8859-16:2001': - case 'L10': - case 'LATIN10': - return 'ISO-8859-16'; - - case 'CSISOLATIN2': - case 'ISO-8859-2': - case 'ISO-IR-101': - case 'ISO_8859-2': - case 'ISO_8859-2:1987': - case 'L2': - case 'LATIN2': + + case 'csisolatin2': + case 'iso88592': + case 'isoir101': + case 'iso88592': + case 'iso885921987': + case 'l2': + case 'latin2': return 'ISO-8859-2'; - - case 'CSWINDOWS31LATIN2': - case 'ISO-8859-2-WINDOWS-LATIN-2': + + case 'cswindows31latin2': + case 'iso88592windowslatin2': return 'ISO-8859-2-Windows-Latin-2'; - - case 'CSISOLATIN3': - case 'ISO-8859-3': - case 'ISO-IR-109': - case 'ISO_8859-3': - case 'ISO_8859-3:1988': - case 'L3': - case 'LATIN3': + + case 'csisolatin3': + case 'iso88593': + case 'isoir109': + case 'iso88593': + case 'iso885931988': + case 'l3': + case 'latin3': return 'ISO-8859-3'; - - case 'CSISOLATIN4': - case 'ISO-8859-4': - case 'ISO-IR-110': - case 'ISO_8859-4': - case 'ISO_8859-4:1988': - case 'L4': - case 'LATIN4': + + case 'csisolatin4': + case 'iso88594': + case 'isoir110': + case 'iso88594': + case 'iso885941988': + case 'l4': + case 'latin4': return 'ISO-8859-4'; - - case 'CSISOLATINCYRILLIC': - case 'CYRILLIC': - case 'ISO-8859-5': - case 'ISO-IR-144': - case 'ISO_8859-5': - case 'ISO_8859-5:1988': + + case 'csisolatincyrillic': + case 'cyrillic': + case 'iso88595': + case 'isoir144': + case 'iso88595': + case 'iso885951988': return 'ISO-8859-5'; - - case 'ARABIC': - case 'ASMO-708': - case 'CSISOLATINARABIC': - case 'ECMA-114': - case 'ISO-8859-6': - case 'ISO-IR-127': - case 'ISO_8859-6': - case 'ISO_8859-6:1987': + + case 'arabic': + case 'asmo708': + case 'csisolatinarabic': + case 'ecma114': + case 'iso88596': + case 'isoir127': + case 'iso88596': + case 'iso885961987': return 'ISO-8859-6'; - - case 'CSISO88596E': - case 'ISO-8859-6-E': - case 'ISO_8859-6-E': + + case 'csiso88596e': + case 'iso88596e': + case 'iso88596e': return 'ISO-8859-6-E'; - - case 'CSISO88596I': - case 'ISO-8859-6-I': - case 'ISO_8859-6-I': + + case 'csiso88596i': + case 'iso88596i': + case 'iso88596i': return 'ISO-8859-6-I'; - - case 'CSISOLATINGREEK': - case 'ECMA-118': - case 'ELOT_928': - case 'GREEK': - case 'GREEK8': - case 'ISO-8859-7': - case 'ISO-IR-126': - case 'ISO_8859-7': - case 'ISO_8859-7:1987': + + case 'csisolatingreek': + case 'ecma118': + case 'elot928': + case 'greek': + case 'greek8': + case 'iso88597': + case 'isoir126': + case 'iso88597': + case 'iso885971987': return 'ISO-8859-7'; - - case 'CSISOLATINHEBREW': - case 'HEBREW': - case 'ISO-8859-8': - case 'ISO-IR-138': - case 'ISO_8859-8': - case 'ISO_8859-8:1988': + + case 'csisolatinhebrew': + case 'hebrew': + case 'iso88598': + case 'isoir138': + case 'iso88598': + case 'iso885981988': return 'ISO-8859-8'; - - case 'CSISO88598E': - case 'ISO-8859-8-E': - case 'ISO_8859-8-E': + + case 'csiso88598e': + case 'iso88598e': + case 'iso88598e': return 'ISO-8859-8-E'; - - case 'CSISO88598I': - case 'ISO-8859-8-I': - case 'ISO_8859-8-I': + + case 'csiso88598i': + case 'iso88598i': + case 'iso88598i': return 'ISO-8859-8-I'; - - case 'CSISOLATIN5': - case 'ISO-8859-9': - case 'ISO-IR-148': - case 'ISO_8859-9': - case 'ISO_8859-9:1989': - case 'L5': - case 'LATIN5': - return 'ISO-8859-9'; - - case 'CSWINDOWS31LATIN5': - case 'ISO-8859-9-WINDOWS-LATIN-5': + + case 'cswindows31latin5': + case 'iso88599windowslatin5': return 'ISO-8859-9-Windows-Latin-5'; - - case 'CSUNICODEIBM1261': - case 'ISO-UNICODE-IBM-1261': + + case 'csisolatin6': + case 'iso885910': + case 'isoir157': + case 'iso8859101992': + case 'l6': + case 'latin6': + return 'ISO-8859-10'; + + case 'iso885913': + return 'ISO-8859-13'; + + case 'iso885914': + case 'isoceltic': + case 'isoir199': + case 'iso885914': + case 'iso8859141998': + case 'l8': + case 'latin8': + return 'ISO-8859-14'; + + case 'iso885915': + case 'iso885915': + case 'latin9': + return 'ISO-8859-15'; + + case 'iso885916': + case 'isoir226': + case 'iso885916': + case 'iso8859162001': + case 'l10': + case 'latin10': + return 'ISO-8859-16'; + + case 'iso10646j1': + return 'ISO-10646-J-1'; + + case 'csunicode': + case 'iso10646ucs2': + return 'ISO-10646-UCS-2'; + + case 'csucs4': + case 'iso10646ucs4': + return 'ISO-10646-UCS-4'; + + case 'csunicodeascii': + case 'iso10646ucsbasic': + return 'ISO-10646-UCS-Basic'; + + case 'csunicodelatin1': + case 'iso10646': + case 'iso10646unicodelatin1': + return 'ISO-10646-Unicode-Latin1'; + + case 'csiso10646utf1': + case 'iso10646utf1': + return 'ISO-10646-UTF-1'; + + case 'csiso115481': + case 'iso115481': + case 'iso115481': + case 'isotr115481': + return 'ISO-11548-1'; + + case 'csiso90': + case 'isoir90': + return 'iso-ir-90'; + + case 'csunicodeibm1261': + case 'isounicodeibm1261': return 'ISO-Unicode-IBM-1261'; - - case 'CSUNICODEIBM1264': - case 'ISO-UNICODE-IBM-1264': + + case 'csunicodeibm1264': + case 'isounicodeibm1264': return 'ISO-Unicode-IBM-1264'; - - case 'CSUNICODEIBM1265': - case 'ISO-UNICODE-IBM-1265': + + case 'csunicodeibm1265': + case 'isounicodeibm1265': return 'ISO-Unicode-IBM-1265'; - - case 'CSUNICODEIBM1268': - case 'ISO-UNICODE-IBM-1268': + + case 'csunicodeibm1268': + case 'isounicodeibm1268': return 'ISO-Unicode-IBM-1268'; - - case 'CSUNICODEIBM1276': - case 'ISO-UNICODE-IBM-1276': + + case 'csunicodeibm1276': + case 'isounicodeibm1276': return 'ISO-Unicode-IBM-1276'; - - case 'CSISO10367BOX': - case 'ISO-IR-155': - case 'ISO_10367-BOX': - return 'ISO_10367-box'; - - case 'CSISO2033': - case 'E13B': - case 'ISO-IR-98': - case 'ISO_2033-1983': + + case 'csiso646basic1983': + case 'iso646basic1983': + case 'ref': + return 'ISO_646.basic:1983'; + + case 'csiso2intlrefversion': + case 'irv': + case 'isoir2': + case 'iso646irv1983': + return 'ISO_646.irv:1983'; + + case 'csiso2033': + case 'e13b': + case 'isoir98': + case 'iso20331983': return 'ISO_2033-1983'; - - case 'CSISO5427CYRILLIC': - case 'ISO-IR-37': - case 'ISO_5427': + + case 'csiso5427cyrillic': + case 'isoir37': + case 'iso5427': return 'ISO_5427'; - - case 'ISO-IR-54': - case 'ISO5427CYRILLIC1981': - case 'ISO_5427:1981': + + case 'isoir54': + case 'iso5427cyrillic1981': + case 'iso54271981': return 'ISO_5427:1981'; - - case 'CSISO5428GREEK': - case 'ISO-IR-55': - case 'ISO_5428:1980': + + case 'csiso5428greek': + case 'isoir55': + case 'iso54281980': return 'ISO_5428:1980'; - - case 'CSISO646BASIC1983': - case 'ISO_646.BASIC:1983': - case 'REF': - return 'ISO_646.basic:1983'; - - case 'CSISO2INTLREFVERSION': - case 'IRV': - case 'ISO-IR-2': - case 'ISO_646.IRV:1983': - return 'ISO_646.irv:1983'; - - case 'CSISO6937ADD': - case 'ISO-IR-152': - case 'ISO_6937-2-25': + + case 'csiso6937add': + case 'isoir152': + case 'iso6937225': return 'ISO_6937-2-25'; - - case 'CSISOTEXTCOMM': - case 'ISO-IR-142': - case 'ISO_6937-2-ADD': + + case 'csisotextcomm': + case 'isoir142': + case 'iso69372add': return 'ISO_6937-2-add'; - - case 'CSISO8859SUPP': - case 'ISO-IR-154': - case 'ISO_8859-SUPP': - case 'LATIN1-2-5': + + case 'csiso8859supp': + case 'isoir154': + case 'iso8859supp': + case 'latin125': return 'ISO_8859-supp'; - - case 'CSISO15ITALIAN': - case 'ISO-IR-15': - case 'ISO646-IT': - case 'IT': + + case 'csiso10367box': + case 'isoir155': + case 'iso10367box': + return 'ISO_10367-box'; + + case 'csiso15italian': + case 'isoir15': + case 'iso646it': + case 'it': return 'IT'; - - case 'CSISO13JISC6220JP': - case 'ISO-IR-13': - case 'JIS_C6220-1969': - case 'JIS_C6220-1969-JP': - case 'KATAKANA': - case 'X0201-7': + + case 'csiso13jisc6220jp': + case 'isoir13': + case 'jisc62201969': + case 'jisc62201969jp': + case 'katakana': + case 'x02017': return 'JIS_C6220-1969-jp'; - - case 'CSISO14JISC6220RO': - case 'ISO-IR-14': - case 'ISO646-JP': - case 'JIS_C6220-1969-RO': - case 'JP': + + case 'csiso14jisc6220ro': + case 'isoir14': + case 'iso646jp': + case 'jisc62201969ro': + case 'jp': return 'JIS_C6220-1969-ro'; - - case 'CSISO42JISC62261978': - case 'ISO-IR-42': - case 'JIS_C6226-1978': + + case 'csiso42jisc62261978': + case 'isoir42': + case 'jisc62261978': return 'JIS_C6226-1978'; - - case 'CSISO87JISX0208': - case 'ISO-IR-87': - case 'JIS_C6226-1983': - case 'JIS_X0208-1983': - case 'X0208': + + case 'csiso87jisx0208': + case 'isoir87': + case 'jisc62261983': + case 'jisx02081983': + case 'x0208': return 'JIS_C6226-1983'; - - case 'CSISO91JISC62291984A': - case 'ISO-IR-91': - case 'JIS_C6229-1984-A': - case 'JP-OCR-A': + + case 'csiso91jisc62291984a': + case 'isoir91': + case 'jisc62291984a': + case 'jpocra': return 'JIS_C6229-1984-a'; - - case 'CSISO92JISC62991984B': - case 'ISO-IR-92': - case 'ISO646-JP-OCR-B': - case 'JIS_C6229-1984-B': - case 'JP-OCR-B': + + case 'csiso92jisc62991984b': + case 'isoir92': + case 'iso646jpocrb': + case 'jisc62291984b': + case 'jpocrb': return 'JIS_C6229-1984-b'; - - case 'CSISO93JIS62291984BADD': - case 'ISO-IR-93': - case 'JIS_C6229-1984-B-ADD': - case 'JP-OCR-B-ADD': + + case 'csiso93jis62291984badd': + case 'isoir93': + case 'jisc62291984badd': + case 'jpocrbadd': return 'JIS_C6229-1984-b-add'; - - case 'CSISO94JIS62291984HAND': - case 'ISO-IR-94': - case 'JIS_C6229-1984-HAND': - case 'JP-OCR-HAND': + + case 'csiso94jis62291984hand': + case 'isoir94': + case 'jisc62291984hand': + case 'jpocrhand': return 'JIS_C6229-1984-hand'; - - case 'CSISO95JIS62291984HANDADD': - case 'ISO-IR-95': - case 'JIS_C6229-1984-HAND-ADD': - case 'JP-OCR-HAND-ADD': + + case 'csiso95jis62291984handadd': + case 'isoir95': + case 'jisc62291984handadd': + case 'jpocrhandadd': return 'JIS_C6229-1984-hand-add'; - - case 'CSISO96JISC62291984KANA': - case 'ISO-IR-96': - case 'JIS_C6229-1984-KANA': + + case 'csiso96jisc62291984kana': + case 'isoir96': + case 'jisc62291984kana': return 'JIS_C6229-1984-kana'; - - case 'CSJISENCODING': - case 'JIS_ENCODING': + + case 'csjisencoding': + case 'jisencoding': return 'JIS_Encoding'; - - case 'CSHALFWIDTHKATAKANA': - case 'JIS_X0201': - case 'X0201': + + case 'cshalfwidthkatakana': + case 'jisx0201': + case 'x0201': return 'JIS_X0201'; - - case 'CSISO159JISX02121990': - case 'ISO-IR-159': - case 'JIS_X0212-1990': - case 'X0212': + + case 'csiso159jisx02121990': + case 'isoir159': + case 'jisx02121990': + case 'x0212': return 'JIS_X0212-1990'; - - case 'CSISO141JUSIB1002': - case 'ISO-IR-141': - case 'ISO646-YU': - case 'JS': - case 'JUS_I.B1.002': - case 'YU': + + case 'csiso141jusib1002': + case 'isoir141': + case 'iso646yu': + case 'js': + case 'jusib1002': + case 'yu': return 'JUS_I.B1.002'; - - case 'CSISO147MACEDONIAN': - case 'ISO-IR-147': - case 'JUS_I.B1.003-MAC': - case 'MACEDONIAN': + + case 'csiso147macedonian': + case 'isoir147': + case 'jusib1003mac': + case 'macedonian': return 'JUS_I.B1.003-mac'; - - case 'CSISO146SERBIAN': - case 'ISO-IR-146': - case 'JUS_I.B1.003-SERB': - case 'SERBIAN': + + case 'csiso146serbian': + case 'isoir146': + case 'jusib1003serb': + case 'serbian': return 'JUS_I.B1.003-serb'; - - case 'KOI7-SWITCHED': + + case 'koi7switched': return 'KOI7-switched'; - - case 'CSKOI8R': - case 'KOI8-R': + + case 'cskoi8r': + case 'koi8r': return 'KOI8-R'; - - case 'KOI8-U': + + case 'koi8u': return 'KOI8-U'; - - case 'CSKSC5636': - case 'ISO646-KR': - case 'KSC5636': + + case 'csksc5636': + case 'iso646kr': + case 'ksc5636': return 'KSC5636'; - - case 'CSKSC56011987': - case 'ISO-IR-149': - case 'KOREAN': - case 'KSC_5601': - case 'KS_C_5601-1987': - case 'KS_C_5601-1989': - return 'KS_C_5601-1987'; - - case 'CSKZ1048': - case 'KZ-1048': - case 'RK1048': - case 'STRK1048-2002': + + case 'cskz1048': + case 'kz1048': + case 'rk1048': + case 'strk10482002': return 'KZ-1048'; - - case 'CSISO27LATINGREEK1': - case 'ISO-IR-27': - case 'LATIN-GREEK-1': + + case 'csiso19latingreek': + case 'isoir19': + case 'latingreek': + return 'latin-greek'; + + case 'csiso27latingreek1': + case 'isoir27': + case 'latingreek1': return 'Latin-greek-1'; - - case 'CSMNEM': - case 'MNEM': + + case 'csiso158lap': + case 'isoir158': + case 'lap': + case 'latinlap': + return 'latin-lap'; + + case 'csmacintosh': + case 'mac': + case 'macintosh': + return 'macintosh'; + + case 'csmicrosoftpublishing': + case 'microsoftpublishing': + return 'Microsoft-Publishing'; + + case 'csmnem': + case 'mnem': return 'MNEM'; - - case 'CSMNEMONIC': - case 'MNEMONIC': + + case 'csmnemonic': + case 'mnemonic': return 'MNEMONIC'; - - case 'CSISO86HUNGARIAN': - case 'HU': - case 'ISO-IR-86': - case 'ISO646-HU': - case 'MSZ_7795.3': + + case 'csiso86hungarian': + case 'hu': + case 'isoir86': + case 'iso646hu': + case 'msz77953': return 'MSZ_7795.3'; - - case 'CSMICROSOFTPUBLISHING': - case 'MICROSOFT-PUBLISHING': - return 'Microsoft-Publishing'; - - case 'CSNATSDANO': - case 'ISO-IR-9-1': - case 'NATS-DANO': + + case 'csnatsdano': + case 'isoir91': + case 'natsdano': return 'NATS-DANO'; - - case 'CSNATSDANOADD': - case 'ISO-IR-9-2': - case 'NATS-DANO-ADD': + + case 'csnatsdanoadd': + case 'isoir92': + case 'natsdanoadd': return 'NATS-DANO-ADD'; - - case 'CSNATSSEFI': - case 'ISO-IR-8-1': - case 'NATS-SEFI': + + case 'csnatssefi': + case 'isoir81': + case 'natssefi': return 'NATS-SEFI'; - - case 'CSNATSSEFIADD': - case 'ISO-IR-8-2': - case 'NATS-SEFI-ADD': + + case 'csnatssefiadd': + case 'isoir82': + case 'natssefiadd': return 'NATS-SEFI-ADD'; - - case 'CSISO151CUBA': - case 'CUBA': - case 'ISO-IR-151': - case 'ISO646-CU': - case 'NC_NC00-10:81': + + case 'csiso151cuba': + case 'cuba': + case 'isoir151': + case 'iso646cu': + case 'ncnc001081': return 'NC_NC00-10:81'; - - case 'CSISO69FRENCH': - case 'FR': - case 'ISO-IR-69': - case 'ISO646-FR': - case 'NF_Z_62-010': + + case 'csiso69french': + case 'fr': + case 'isoir69': + case 'iso646fr': + case 'nfz62010': return 'NF_Z_62-010'; - - case 'CSISO25FRENCH': - case 'ISO-IR-25': - case 'ISO646-FR1': - case 'NF_Z_62-010_(1973)': + + case 'csiso25french': + case 'isoir25': + case 'iso646fr1': + case 'nfz620101973': return 'NF_Z_62-010_(1973)'; - - case 'CSISO60DANISHNORWEGIAN': - case 'CSISO60NORWEGIAN1': - case 'ISO-IR-60': - case 'ISO646-NO': - case 'NO': - case 'NS_4551-1': + + case 'csiso60danishnorwegian': + case 'csiso60norwegian1': + case 'isoir60': + case 'iso646no': + case 'no': + case 'ns45511': return 'NS_4551-1'; - - case 'CSISO61NORWEGIAN2': - case 'ISO-IR-61': - case 'ISO646-NO2': - case 'NO2': - case 'NS_4551-2': + + case 'csiso61norwegian2': + case 'isoir61': + case 'iso646no2': + case 'no2': + case 'ns45512': return 'NS_4551-2'; - - case 'OSD_EBCDIC_DF03_IRV': + + case 'osdebcdicdf03irv': return 'OSD_EBCDIC_DF03_IRV'; - - case 'OSD_EBCDIC_DF04_1': + + case 'osdebcdicdf041': return 'OSD_EBCDIC_DF04_1'; - - case 'OSD_EBCDIC_DF04_15': + + case 'osdebcdicdf0415': return 'OSD_EBCDIC_DF04_15'; - - case 'CSPC8DANISHNORWEGIAN': - case 'PC8-DANISH-NORWEGIAN': + + case 'cspc8danishnorwegian': + case 'pc8danishnorwegian': return 'PC8-Danish-Norwegian'; - - case 'CSPC8TURKISH': - case 'PC8-TURKISH': + + case 'cspc8turkish': + case 'pc8turkish': return 'PC8-Turkish'; - - case 'CSISO16PORTUGUESE': - case 'ISO-IR-16': - case 'ISO646-PT': - case 'PT': + + case 'csiso16portuguese': + case 'isoir16': + case 'iso646pt': + case 'pt': return 'PT'; - - case 'CSISO84PORTUGUESE2': - case 'ISO-IR-84': - case 'ISO646-PT2': - case 'PT2': + + case 'csiso84portuguese2': + case 'isoir84': + case 'iso646pt2': + case 'pt2': return 'PT2'; - - case 'CP154': - case 'CSPTCP154': - case 'CYRILLIC-ASIAN': - case 'PT154': - case 'PTCP154': + + case 'cp154': + case 'csptcp154': + case 'cyrillicasian': + case 'pt154': + case 'ptcp154': return 'PTCP154'; - - case 'SCSU': + + case 'scsu': return 'SCSU'; - - case 'CSISO10SWEDISH': - case 'FI': - case 'ISO-IR-10': - case 'ISO646-FI': - case 'ISO646-SE': - case 'SE': - case 'SEN_850200_B': + + case 'csiso10swedish': + case 'fi': + case 'isoir10': + case 'iso646fi': + case 'iso646se': + case 'se': + case 'sen850200b': return 'SEN_850200_B'; - - case 'CSISO11SWEDISHFORNAMES': - case 'ISO-IR-11': - case 'ISO646-SE2': - case 'SE2': - case 'SEN_850200_C': + + case 'csiso11swedishfornames': + case 'isoir11': + case 'iso646se2': + case 'se2': + case 'sen850200c': return 'SEN_850200_C'; - - case 'CSSHIFTJIS': - case 'MS_KANJI': - case 'SHIFT_JIS': + + case 'csshiftjis': + case 'mskanji': + case 'shiftjis': return 'Shift_JIS'; - - case 'CSISO128T101G2': - case 'ISO-IR-128': - case 'T.101-G2': - return 'T.101-G2'; - - case 'CSISO102T617BIT': - case 'ISO-IR-102': - case 'T.61-7BIT': + + case 'csiso102t617bit': + case 'isoir102': + case 't617bit': return 'T.61-7bit'; - - case 'CSISO103T618BIT': - case 'ISO-IR-103': - case 'T.61': - case 'T.61-8BIT': + + case 'csiso103t618bit': + case 'isoir103': + case 't61': + case 't618bit': return 'T.61-8bit'; - - case 'CSTSCII': - case 'TSCII': + + case 'csiso128t101g2': + case 'isoir128': + case 't101g2': + return 'T.101-G2'; + + case 'cstscii': + case 'tscii': return 'TSCII'; - - case 'CSUNICODE11': - case 'UNICODE-1-1': + + case 'csunicode11': + case 'unicode11': return 'UNICODE-1-1'; - - case 'CSUNICODE11UTF7': - case 'UNICODE-1-1-UTF-7': + + case 'csunicode11utf7': + case 'unicode11utf7': return 'UNICODE-1-1-UTF-7'; - - case 'CSUNKNOWN8BIT': - case 'UNKNOWN-8BIT': + + case 'csunknown8bit': + case 'unknown8bit': return 'UNKNOWN-8BIT'; - - case 'ANSI': - case 'ANSI_X3.4-1968': - case 'ANSI_X3.4-1986': - case 'ASCII': - case 'CP367': - case 'CSASCII': - case 'IBM367': - case 'ISO-IR-6': - case 'ISO646-US': - case 'ISO_646.IRV:1991': - case 'US': - case 'US-ASCII': + + case 'ansix341968': + case 'ansix341986': + case 'ascii': + case 'cp367': + case 'csascii': + case 'ibm367': + case 'isoir6': + case 'iso646us': + case 'iso646irv1991': + case 'us': + case 'usascii': return 'US-ASCII'; - - case 'UTF-16': + + case 'csusdk': + case 'usdk': + return 'us-dk'; + + case 'utf7': + return 'UTF-7'; + + case 'utf8': + return 'UTF-8'; + + case 'utf16': return 'UTF-16'; - - case 'UTF-16BE': + + case 'utf16be': return 'UTF-16BE'; - - case 'UTF-16LE': + + case 'utf16le': return 'UTF-16LE'; - - case 'UTF-32': + + case 'utf32': return 'UTF-32'; - - case 'UTF-32BE': + + case 'utf32be': return 'UTF-32BE'; - - case 'UTF-32LE': + + case 'utf32le': return 'UTF-32LE'; - - case 'UTF-7': - return 'UTF-7'; - - case 'UTF-8': - return 'UTF-8'; - - case 'CSVIQR': - case 'VIQR': - return 'VIQR'; - - case 'CSVISCII': - case 'VISCII': - return 'VISCII'; - - case 'CSVENTURAINTERNATIONAL': - case 'VENTURA-INTERNATIONAL': + + case 'csventurainternational': + case 'venturainternational': return 'Ventura-International'; - - case 'CSVENTURAMATH': - case 'VENTURA-MATH': + + case 'csventuramath': + case 'venturamath': return 'Ventura-Math'; - - case 'CSVENTURAUS': - case 'VENTURA-US': + + case 'csventuraus': + case 'venturaus': return 'Ventura-US'; - - case 'CSWINDOWS31J': - case 'WINDOWS-31J': - return 'Windows-31J'; - - case 'CSDKUS': - case 'DK-US': - return 'dk-us'; - - case 'CSISO150': - case 'CSISO150GREEKCCITT': - case 'GREEK-CCITT': - case 'ISO-IR-150': - return 'greek-ccitt'; - - case 'CSISO88GREEK7': - case 'GREEK7': - case 'ISO-IR-88': - return 'greek7'; - - case 'CSISO18GREEK7OLD': - case 'GREEK7-OLD': - case 'ISO-IR-18': - return 'greek7-old'; - - case 'CSHPROMAN8': - case 'HP-ROMAN8': - case 'R8': - case 'ROMAN8': - return 'hp-roman8'; - - case 'CSISO90': - case 'ISO-IR-90': - return 'iso-ir-90'; - - case 'CSISO19LATINGREEK': - case 'ISO-IR-19': - case 'LATIN-GREEK': - return 'latin-greek'; - - case 'CSISO158LAP': - case 'ISO-IR-158': - case 'LAP': - case 'LATIN-LAP': - return 'latin-lap'; - - case 'CSMACINTOSH': - case 'MAC': - case 'MACINTOSH': - return 'macintosh'; - - case 'CSUSDK': - case 'US-DK': - return 'us-dk'; - - case 'CSISO70VIDEOTEXSUPP1': - case 'ISO-IR-70': - case 'VIDEOTEX-SUPPL': + + case 'csiso70videotexsupp1': + case 'isoir70': + case 'videotexsuppl': return 'videotex-suppl'; - - case 'WINDOWS-1250': + + case 'csviqr': + case 'viqr': + return 'VIQR'; + + case 'csviscii': + case 'viscii': + return 'VISCII'; + + case 'cswindows31j': + case 'windows31j': + return 'Windows-31J'; + + case 'iso885911': + case 'tis620': + return 'Windows-874'; + + case 'cseuckr': + case 'euckr': + case 'windows949': + case 'csksc56011987': + case 'isoir149': + case 'korean': + case 'ksc5601': + case 'ksc56011987': + case 'ksc56011989': + return 'Windows-949'; + + case 'windows1250': return 'windows-1250'; - - case 'WINDOWS-1251': + + case 'windows1251': return 'windows-1251'; - - case 'CP819': - case 'CSISOLATIN1': - case 'IBM819': - case 'ISO-8859-1': - case 'ISO-IR-100': - case 'ISO_8859-1': - case 'ISO_8859-1:1987': - case 'L1': - case 'LATIN1': - case 'WINDOWS-1252': + + case 'cp819': + case 'csisolatin1': + case 'ibm819': + case 'iso88591': + case 'isoir100': + case 'iso885911987': + case 'l1': + case 'latin1': + case 'windows1252': + return 'Windows-1252'; + + case 'windows1252': return 'windows-1252'; - - case 'WINDOWS-1253': + + case 'windows1253': return 'windows-1253'; - - case 'WINDOWS-1254': + + case 'csisolatin5': + case 'iso88599': + case 'isoir148': + case 'iso885991989': + case 'l5': + case 'latin5': + case 'windows1254': + return 'Windows-1254'; + + case 'windows1254': return 'windows-1254'; - - case 'WINDOWS-1255': + + case 'windows1255': return 'windows-1255'; - - case 'WINDOWS-1256': + + case 'windows1256': return 'windows-1256'; - - case 'WINDOWS-1257': + + case 'windows1257': return 'windows-1257'; - - case 'WINDOWS-1258': + + case 'windows1258': return 'windows-1258'; - + default: - return $encoding; + return $charset; } } @@ -10227,9 +10576,9 @@ class SimplePie_Misc $position = 0; $length = strlen($string); $depth = 0; - + $output = ''; - + while ($position < $length && ($pos = strpos($string, '(', $position)) !== false) { $output .= substr($string, $position, $pos - $position); @@ -10252,7 +10601,7 @@ class SimplePie_Misc case '(': $depth++; break; - + case ')': $depth--; break; @@ -10271,7 +10620,7 @@ class SimplePie_Misc } } $output .= substr($string, $position); - + return $output; } @@ -10535,7 +10884,7 @@ class SimplePie_Misc trigger_error('needle is not a string or an integer', E_USER_WARNING); return false; } - + return strpos(strtolower($haystack), $needle, $offset); } } @@ -10571,7 +10920,7 @@ class SimplePie_Misc return $return; } - + /** * Detect XML encoding, as per XML 1.0 Appendix F.1 * @@ -11385,7 +11734,7 @@ class SimplePie_Parse_Date { $this->day_pcre = '(' . implode(array_keys($this->day), '|') . ')'; $this->month_pcre = '(' . implode(array_keys($this->month), '|') . ')'; - + static $cache; if (!isset($cache[get_class($this)])) { @@ -11403,7 +11752,7 @@ class SimplePie_Parse_Date { $all_methods = get_class_methods($this); } - + foreach ($all_methods as $method) { if (strtolower(substr($method, 0, 5)) === 'date_') @@ -11412,13 +11761,13 @@ class SimplePie_Parse_Date } } } - + foreach ($cache[get_class($this)] as $method) { $this->built_in[] = $method; } } - + /** * Get the object * @@ -11451,7 +11800,7 @@ class SimplePie_Parse_Date return $returned; } } - + foreach ($this->built_in as $method) { if (($returned = call_user_func(array(&$this, $method), $date)) !== false) @@ -11690,7 +12039,7 @@ class SimplePie_Parse_Date { $match[4] += 1900; } - + // Second is optional, if it is empty set it to zero if ($match[7] !== '') { @@ -11850,7 +12199,7 @@ class SimplePie_Content_Type_Sniffer * @access private */ var $file; - + /** * Create an instance of the class with the input file * @@ -11861,7 +12210,7 @@ class SimplePie_Content_Type_Sniffer { $this->file = $file; } - + /** * Get the Content-Type of the specified file * @@ -11879,9 +12228,9 @@ class SimplePie_Content_Type_Sniffer { return $this->text_or_binary(); } - + if (($pos = strpos($this->file->headers['content-type'], ';')) !== false) - { + { $official = substr($this->file->headers['content-type'], 0, $pos); } else @@ -11889,7 +12238,7 @@ class SimplePie_Content_Type_Sniffer $official = $this->file->headers['content-type']; } $official = strtolower($official); - + if ($official === 'unknown/unknown' || $official === 'application/unknown') { @@ -11926,7 +12275,7 @@ class SimplePie_Content_Type_Sniffer return $this->unknown(); } } - + /** * Sniff text or binary * @@ -11951,7 +12300,7 @@ class SimplePie_Content_Type_Sniffer return 'text/plain'; } } - + /** * Sniff unknown * @@ -11997,7 +12346,7 @@ class SimplePie_Content_Type_Sniffer return $this->text_or_binary(); } } - + /** * Sniff images * @@ -12028,7 +12377,7 @@ class SimplePie_Content_Type_Sniffer return false; } } - + /** * Sniff HTML * @@ -12039,7 +12388,7 @@ class SimplePie_Content_Type_Sniffer { $len = strlen($this->file->body); $pos = strspn($this->file->body, "\x09\x0A\x0D\x20"); - + while ($pos < $len) { switch ($this->file->body[$pos]) @@ -12050,15 +12399,15 @@ class SimplePie_Content_Type_Sniffer case "\x20": $pos += strspn($this->file->body, "\x09\x0A\x0D\x20", $pos); continue 2; - + case '<': $pos++; break; - + default: return 'text/html'; } - + if (substr($this->file->body, $pos, 3) === '!--') { $pos += 3; @@ -12107,7 +12456,7 @@ class SimplePie_Content_Type_Sniffer return 'text/html'; } } - + return 'text/html'; } } @@ -12126,7 +12475,7 @@ class SimplePie_XML_Declaration_Parser * @var string */ var $version = '1.0'; - + /** * Encoding * @@ -12134,7 +12483,7 @@ class SimplePie_XML_Declaration_Parser * @var string */ var $encoding = 'UTF-8'; - + /** * Standalone * @@ -12150,7 +12499,7 @@ class SimplePie_XML_Declaration_Parser * @var string */ var $state = 'before_version_name'; - + /** * Input data * @@ -12174,7 +12523,7 @@ class SimplePie_XML_Declaration_Parser * @access private */ var $position = 0; - + /** * Create an instance of the class with the input data * @@ -12224,7 +12573,7 @@ class SimplePie_XML_Declaration_Parser { return (bool) ($this->position < $this->data_length); } - + /** * Advance past any whitespace * @@ -12236,7 +12585,7 @@ class SimplePie_XML_Declaration_Parser $this->position += $whitespace; return $whitespace; } - + /** * Read value */ @@ -12256,7 +12605,7 @@ class SimplePie_XML_Declaration_Parser } return false; } - + function before_version_name() { if ($this->skip_whitespace()) @@ -12268,7 +12617,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function version_name() { if (substr($this->data, $this->position, 7) === 'version') @@ -12282,7 +12631,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function version_equals() { if (substr($this->data, $this->position, 1) === '=') @@ -12296,7 +12645,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function version_value() { if ($this->version = $this->get_value()) @@ -12316,7 +12665,7 @@ class SimplePie_XML_Declaration_Parser $this->state = 'standalone_name'; } } - + function encoding_name() { if (substr($this->data, $this->position, 8) === 'encoding') @@ -12330,7 +12679,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function encoding_equals() { if (substr($this->data, $this->position, 1) === '=') @@ -12344,7 +12693,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function encoding_value() { if ($this->encoding = $this->get_value()) @@ -12364,7 +12713,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function standalone_name() { if (substr($this->data, $this->position, 10) === 'standalone') @@ -12378,7 +12727,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function standalone_equals() { if (substr($this->data, $this->position, 1) === '=') @@ -12392,7 +12741,7 @@ class SimplePie_XML_Declaration_Parser $this->state = false; } } - + function standalone_value() { if ($standalone = $this->get_value()) @@ -12402,16 +12751,16 @@ class SimplePie_XML_Declaration_Parser case 'yes': $this->standalone = true; break; - + case 'no': $this->standalone = false; break; - + default: $this->state = false; return; } - + $this->skip_whitespace(); if ($this->has_data()) { @@ -12461,7 +12810,7 @@ class SimplePie_Locator { return $this->file; } - + if ($this->file->method & SIMPLEPIE_FILE_SOURCE_REMOTE) { $sniffer = new $this->content_type_sniffer_class($this->file); @@ -12512,7 +12861,7 @@ class SimplePie_Locator { $sniffer = new $this->content_type_sniffer_class($file); $sniffed = $sniffer->get_type(); - if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'application/atom+xml', 'text/xml', 'application/xml', 'text/plain'))) + if (in_array($sniffed, array('application/rss+xml', 'application/rdf+xml', 'text/rdf', 'application/atom+xml', 'text/xml', 'application/xml'))) { return true; } @@ -12735,7 +13084,7 @@ class SimplePie_Parser { $data = substr($data, 3); } - + if (substr($data, 0, 5) === '')) !== false) { $declaration = new SimplePie_XML_Declaration_Parser(substr($data, 5, $pos - 5)); @@ -12750,7 +13099,14 @@ class SimplePie_Parser return false; } } - + + // Work around libxml bug + $data = str_replace('<', '<', $data); + $data = str_replace('>', '>', $data); + $data = str_replace('&', '&', $data); + $data = str_replace(''', ''', $data); + $data = str_replace('"', '"', $data); + $return = true; // Create the parser @@ -12761,10 +13117,6 @@ class SimplePie_Parser xml_set_character_data_handler($xml, 'cdata'); xml_set_element_handler($xml, 'tag_open', 'tag_close'); - $data=str_replace("<","<",$data); - $data=str_replace(">",">",$data); - $data=str_replace("&","&",$data); - // Parse! if (!xml_parse($xml, $data, true)) { -- 2.39.5