PageRenderTime 73ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 1ms

/fuel/packages/simplepie/classes/simplepie/misc.php

https://github.com/mentariworks/feedmalaya-draft
PHP | 2364 lines | 2306 code | 10 blank | 48 comment | 17 complexity | 47e37397823152a946e00e4788d8c861 MD5 | raw file
Possible License(s): MIT

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * SimplePie
  4. *
  5. * A PHP-Based RSS and Atom Feed Framework.
  6. * Takes the hard work out of managing a complete RSS/Atom solution.
  7. *
  8. * Copyright (c) 2004-2009, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
  9. * All rights reserved.
  10. *
  11. * Redistribution and use in source and binary forms, with or without modification, are
  12. * permitted provided that the following conditions are met:
  13. *
  14. * * Redistributions of source code must retain the above copyright notice, this list of
  15. * conditions and the following disclaimer.
  16. *
  17. * * Redistributions in binary form must reproduce the above copyright notice, this list
  18. * of conditions and the following disclaimer in the documentation and/or other materials
  19. * provided with the distribution.
  20. *
  21. * * Neither the name of the SimplePie Team nor the names of its contributors may be used
  22. * to endorse or promote products derived from this software without specific prior
  23. * written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
  26. * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  27. * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
  28. * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  30. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  31. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  32. * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  33. * POSSIBILITY OF SUCH DAMAGE.
  34. *
  35. * @package SimplePie
  36. * @version 1.3-dev
  37. * @copyright 2004-2010 Ryan Parman, Geoffrey Sneddon, Ryan McCue
  38. * @author Ryan Parman
  39. * @author Geoffrey Sneddon
  40. * @author Ryan McCue
  41. * @link http://simplepie.org/ SimplePie
  42. * @license http://www.opensource.org/licenses/bsd-license.php BSD License
  43. * @todo phpDoc comments
  44. */
  45. namespace Simplepie;
  46. class SimplePie_Misc
  47. {
  48. public static function time_hms($seconds)
  49. {
  50. $time = '';
  51. $hours = floor($seconds / 3600);
  52. $remainder = $seconds % 3600;
  53. if ($hours > 0)
  54. {
  55. $time .= $hours.':';
  56. }
  57. $minutes = floor($remainder / 60);
  58. $seconds = $remainder % 60;
  59. if ($minutes < 10 && $hours > 0)
  60. {
  61. $minutes = '0' . $minutes;
  62. }
  63. if ($seconds < 10)
  64. {
  65. $seconds = '0' . $seconds;
  66. }
  67. $time .= $minutes.':';
  68. $time .= $seconds;
  69. return $time;
  70. }
  71. public static function absolutize_url($relative, $base)
  72. {
  73. $iri = SimplePie_IRI::absolutize(new SimplePie_IRI($base), $relative);
  74. return $iri->get_iri();
  75. }
  76. public static function remove_dot_segments($input)
  77. {
  78. $output = '';
  79. while (strpos($input, './') !== false || strpos($input, '/.') !== false || $input === '.' || $input === '..')
  80. {
  81. // A: If the input buffer begins with a prefix of "../" or "./", then remove that prefix from the input buffer; otherwise,
  82. if (strpos($input, '../') === 0)
  83. {
  84. $input = substr($input, 3);
  85. }
  86. elseif (strpos($input, './') === 0)
  87. {
  88. $input = substr($input, 2);
  89. }
  90. // B: if the input buffer begins with a prefix of "/./" or "/.", where "." is a complete path segment, then replace that prefix with "/" in the input buffer; otherwise,
  91. elseif (strpos($input, '/./') === 0)
  92. {
  93. $input = substr_replace($input, '/', 0, 3);
  94. }
  95. elseif ($input === '/.')
  96. {
  97. $input = '/';
  98. }
  99. // C: if the input buffer begins with a prefix of "/../" or "/..", where ".." is a complete path segment, then replace that prefix with "/" in the input buffer and remove the last segment and its preceding "/" (if any) from the output buffer; otherwise,
  100. elseif (strpos($input, '/../') === 0)
  101. {
  102. $input = substr_replace($input, '/', 0, 4);
  103. $output = substr_replace($output, '', strrpos($output, '/'));
  104. }
  105. elseif ($input === '/..')
  106. {
  107. $input = '/';
  108. $output = substr_replace($output, '', strrpos($output, '/'));
  109. }
  110. // D: if the input buffer consists only of "." or "..", then remove that from the input buffer; otherwise,
  111. elseif ($input === '.' || $input === '..')
  112. {
  113. $input = '';
  114. }
  115. // E: move the first path segment in the input buffer to the end of the output buffer, including the initial "/" character (if any) and any subsequent characters up to, but not including, the next "/" character or the end of the input buffer
  116. elseif (($pos = strpos($input, '/', 1)) !== false)
  117. {
  118. $output .= substr($input, 0, $pos);
  119. $input = substr_replace($input, '', 0, $pos);
  120. }
  121. else
  122. {
  123. $output .= $input;
  124. $input = '';
  125. }
  126. }
  127. return $output . $input;
  128. }
  129. public static function get_element($realname, $string)
  130. {
  131. $return = array();
  132. $name = preg_quote($realname, '/');
  133. if (preg_match_all("/<($name)" . SIMPLEPIE_PCRE_HTML_ATTRIBUTE . "(>(.*)<\/$name>|(\/)?>)/siU", $string, $matches, PREG_SET_ORDER | PREG_OFFSET_CAPTURE))
  134. {
  135. for ($i = 0, $total_matches = count($matches); $i < $total_matches; $i++)
  136. {
  137. $return[$i]['tag'] = $realname;
  138. $return[$i]['full'] = $matches[$i][0][0];
  139. $return[$i]['offset'] = $matches[$i][0][1];
  140. if (strlen($matches[$i][3][0]) <= 2)
  141. {
  142. $return[$i]['self_closing'] = true;
  143. }
  144. else
  145. {
  146. $return[$i]['self_closing'] = false;
  147. $return[$i]['content'] = $matches[$i][4][0];
  148. }
  149. $return[$i]['attribs'] = array();
  150. if (isset($matches[$i][2][0]) && preg_match_all('/[\x09\x0A\x0B\x0C\x0D\x20]+([^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x2F\x3D\x3E]*)(?:[\x09\x0A\x0B\x0C\x0D\x20]*=[\x09\x0A\x0B\x0C\x0D\x20]*(?:"([^"]*)"|\'([^\']*)\'|([^\x09\x0A\x0B\x0C\x0D\x20\x22\x27\x3E][^\x09\x0A\x0B\x0C\x0D\x20\x3E]*)?))?/', ' ' . $matches[$i][2][0] . ' ', $attribs, PREG_SET_ORDER))
  151. {
  152. for ($j = 0, $total_attribs = count($attribs); $j < $total_attribs; $j++)
  153. {
  154. if (count($attribs[$j]) === 2)
  155. {
  156. $attribs[$j][2] = $attribs[$j][1];
  157. }
  158. $return[$i]['attribs'][strtolower($attribs[$j][1])]['data'] = SimplePie_Misc::entities_decode(end($attribs[$j]), 'UTF-8');
  159. }
  160. }
  161. }
  162. }
  163. return $return;
  164. }
  165. public static function element_implode($element)
  166. {
  167. $full = "<$element[tag]";
  168. foreach ($element['attribs'] as $key => $value)
  169. {
  170. $key = strtolower($key);
  171. $full .= " $key=\"" . htmlspecialchars($value['data']) . '"';
  172. }
  173. if ($element['self_closing'])
  174. {
  175. $full .= ' />';
  176. }
  177. else
  178. {
  179. $full .= ">$element[content]</$element[tag]>";
  180. }
  181. return $full;
  182. }
  183. public static function error($message, $level, $file, $line)
  184. {
  185. if ((ini_get('error_reporting') & $level) > 0)
  186. {
  187. switch ($level)
  188. {
  189. case E_USER_ERROR:
  190. $note = 'PHP Error';
  191. break;
  192. case E_USER_WARNING:
  193. $note = 'PHP Warning';
  194. break;
  195. case E_USER_NOTICE:
  196. $note = 'PHP Notice';
  197. break;
  198. default:
  199. $note = 'Unknown Error';
  200. break;
  201. }
  202. $log_error = true;
  203. if (!function_exists('error_log'))
  204. {
  205. $log_error = false;
  206. }
  207. $log_file = @ini_get('error_log');
  208. if (!empty($log_file) && ('syslog' !== $log_file) && !@is_writable($log_file))
  209. {
  210. $log_error = false;
  211. }
  212. if ($log_error)
  213. {
  214. @error_log("$note: $message in $file on line $line", 0);
  215. }
  216. }
  217. return $message;
  218. }
  219. public static function fix_protocol($url, $http = 1)
  220. {
  221. $url = SimplePie_Misc::normalize_url($url);
  222. $parsed = SimplePie_Misc::parse_url($url);
  223. if ($parsed['scheme'] !== '' && $parsed['scheme'] !== 'http' && $parsed['scheme'] !== 'https')
  224. {
  225. return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['authority'], $parsed['path'], $parsed['query'], $parsed['fragment']), $http);
  226. }
  227. if ($parsed['scheme'] === '' && $parsed['authority'] === '' && !file_exists($url))
  228. {
  229. return SimplePie_Misc::fix_protocol(SimplePie_Misc::compress_parse_url('http', $parsed['path'], '', $parsed['query'], $parsed['fragment']), $http);
  230. }
  231. if ($http === 2 && $parsed['scheme'] !== '')
  232. {
  233. return "feed:$url";
  234. }
  235. elseif ($http === 3 && strtolower($parsed['scheme']) === 'http')
  236. {
  237. return substr_replace($url, 'podcast', 0, 4);
  238. }
  239. elseif ($http === 4 && strtolower($parsed['scheme']) === 'http')
  240. {
  241. return substr_replace($url, 'itpc', 0, 4);
  242. }
  243. else
  244. {
  245. return $url;
  246. }
  247. }
  248. public static function parse_url($url)
  249. {
  250. $iri = new SimplePie_IRI($url);
  251. return array(
  252. 'scheme' => (string) $iri->get_scheme(),
  253. 'authority' => (string) $iri->get_authority(),
  254. 'path' => (string) $iri->get_path(),
  255. 'query' => (string) $iri->get_query(),
  256. 'fragment' => (string) $iri->get_fragment()
  257. );
  258. }
  259. public static function compress_parse_url($scheme = '', $authority = '', $path = '', $query = '', $fragment = '')
  260. {
  261. $iri = new SimplePie_IRI('');
  262. $iri->set_scheme($scheme);
  263. $iri->set_authority($authority);
  264. $iri->set_path($path);
  265. $iri->set_query($query);
  266. $iri->set_fragment($fragment);
  267. return $iri->get_iri();
  268. }
  269. public static function normalize_url($url)
  270. {
  271. $iri = new SimplePie_IRI($url);
  272. return $iri->get_iri();
  273. }
  274. public static function percent_encoding_normalization($match)
  275. {
  276. $integer = hexdec($match[1]);
  277. if ($integer >= 0x41 && $integer <= 0x5A || $integer >= 0x61 && $integer <= 0x7A || $integer >= 0x30 && $integer <= 0x39 || $integer === 0x2D || $integer === 0x2E || $integer === 0x5F || $integer === 0x7E)
  278. {
  279. return chr($integer);
  280. }
  281. else
  282. {
  283. return strtoupper($match[0]);
  284. }
  285. }
  286. /**
  287. * Converts a Windows-1252 encoded string to a UTF-8 encoded string
  288. *
  289. * @static
  290. * @param string $string Windows-1252 encoded string
  291. * @return string UTF-8 encoded string
  292. */
  293. public static function windows_1252_to_utf8($string)
  294. {
  295. 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");
  296. return strtr($string, $convert_table);
  297. }
  298. /**
  299. * Change a string from one encoding to another
  300. *
  301. * @param string $data Raw data in $input encoding
  302. * @param string $input Encoding of $data
  303. * @param string $output Encoding you want
  304. * @return string|boolean False if we can't convert it
  305. */
  306. public static function change_encoding($data, $input, $output)
  307. {
  308. $input = SimplePie_Misc::encoding($input);
  309. $output = SimplePie_Misc::encoding($output);
  310. // We fail to fail on non US-ASCII bytes
  311. if ($input === 'US-ASCII')
  312. {
  313. static $non_ascii_octects = '';
  314. if (!$non_ascii_octects)
  315. {
  316. for ($i = 0x80; $i <= 0xFF; $i++)
  317. {
  318. $non_ascii_octects .= chr($i);
  319. }
  320. }
  321. $data = substr($data, 0, strcspn($data, $non_ascii_octects));
  322. }
  323. // This is first, as behaviour of this is completely predictable
  324. if ($input === 'windows-1252' && $output === 'UTF-8')
  325. {
  326. return SimplePie_Misc::windows_1252_to_utf8($data);
  327. }
  328. // This is second, as behaviour of this varies only with PHP version (the middle part of this expression checks the encoding is supported).
  329. elseif (function_exists('mb_convert_encoding') && ($return = SimplePie_Misc::change_encoding_mbstring($data, $input, $output)))
  330. {
  331. return $return;
  332. }
  333. // This is last, as behaviour of this varies with OS userland and PHP version
  334. elseif (function_exists('iconv') && ($return = SimplePie_Misc::change_encoding_iconv($data, $input, $output)))
  335. {
  336. return $return;
  337. }
  338. // If we can't do anything, just fail
  339. else
  340. {
  341. return false;
  342. }
  343. }
  344. protected static function change_encoding_mbstring($data, $input, $output)
  345. {
  346. if ($input === 'windows-949')
  347. {
  348. $input = 'EUC-KR';
  349. }
  350. if ($output === 'windows-949')
  351. {
  352. $output = 'EUC-KR';
  353. }
  354. // Check that the encoding is supported
  355. if (@mb_convert_encoding("\x80", 'UTF-16BE', $input) === "\x00\x80")
  356. {
  357. return false;
  358. }
  359. if (!in_array($input, mb_list_encodings()))
  360. {
  361. return false;
  362. }
  363. // Let's do some conversion
  364. if ($return = @mb_convert_encoding($data, $output, $input))
  365. {
  366. return $return;
  367. }
  368. return false;
  369. }
  370. protected static function change_encoding_iconv($data, $input, $output)
  371. {
  372. return @iconv($input, $output, $data);
  373. }
  374. /**
  375. * Normalize an encoding name
  376. *
  377. * This is automatically generated by create.php
  378. *
  379. * To generate it, run `php create.php` on the command line, and copy the
  380. * output to replace this function.
  381. *
  382. * @param string $charset Character set to standardise
  383. * @return string Standardised name
  384. */
  385. public static function encoding($charset)
  386. {
  387. // Normalization from UTS #22
  388. switch (strtolower(preg_replace('/(?:[^a-zA-Z0-9]+|([^0-9])0+)/', '\1', $charset)))
  389. {
  390. case 'adobestandardencoding':
  391. case 'csadobestandardencoding':
  392. return 'Adobe-Standard-Encoding';
  393. case 'adobesymbolencoding':
  394. case 'cshppsmath':
  395. return 'Adobe-Symbol-Encoding';
  396. case 'ami1251':
  397. case 'amiga1251':
  398. return 'Amiga-1251';
  399. case 'ansix31101983':
  400. case 'csat5001983':
  401. case 'csiso99naplps':
  402. case 'isoir99':
  403. case 'naplps':
  404. return 'ANSI_X3.110-1983';
  405. case 'arabic7':
  406. case 'asmo449':
  407. case 'csiso89asmo449':
  408. case 'iso9036':
  409. case 'isoir89':
  410. return 'ASMO_449';
  411. case 'big5':
  412. case 'csbig5':
  413. return 'Big5';
  414. case 'big5hkscs':
  415. return 'Big5-HKSCS';
  416. case 'bocu1':
  417. case 'csbocu1':
  418. return 'BOCU-1';
  419. case 'brf':
  420. case 'csbrf':
  421. return 'BRF';
  422. case 'bs4730':
  423. case 'csiso4unitedkingdom':
  424. case 'gb':
  425. case 'iso646gb':
  426. case 'isoir4':
  427. case 'uk':
  428. return 'BS_4730';
  429. case 'bsviewdata':
  430. case 'csiso47bsviewdata':
  431. case 'isoir47':
  432. return 'BS_viewdata';
  433. case 'cesu8':
  434. case 'cscesu8':
  435. return 'CESU-8';
  436. case 'ca':
  437. case 'csa71':
  438. case 'csaz243419851':
  439. case 'csiso121canadian1':
  440. case 'iso646ca':
  441. case 'isoir121':
  442. return 'CSA_Z243.4-1985-1';
  443. case 'csa72':
  444. case 'csaz243419852':
  445. case 'csiso122canadian2':
  446. case 'iso646ca2':
  447. case 'isoir122':
  448. return 'CSA_Z243.4-1985-2';
  449. case 'csaz24341985gr':
  450. case 'csiso123csaz24341985gr':
  451. case 'isoir123':
  452. return 'CSA_Z243.4-1985-gr';
  453. case 'csiso139csn369103':
  454. case 'csn369103':
  455. case 'isoir139':
  456. return 'CSN_369103';
  457. case 'csdecmcs':
  458. case 'dec':
  459. case 'decmcs':
  460. return 'DEC-MCS';
  461. case 'csiso21german':
  462. case 'de':
  463. case 'din66003':
  464. case 'iso646de':
  465. case 'isoir21':
  466. return 'DIN_66003';
  467. case 'csdkus':
  468. case 'dkus':
  469. return 'dk-us';
  470. case 'csiso646danish':
  471. case 'dk':
  472. case 'ds2089':
  473. case 'iso646dk':
  474. return 'DS_2089';
  475. case 'csibmebcdicatde':
  476. case 'ebcdicatde':
  477. return 'EBCDIC-AT-DE';
  478. case 'csebcdicatdea':
  479. case 'ebcdicatdea':
  480. return 'EBCDIC-AT-DE-A';
  481. case 'csebcdiccafr':
  482. case 'ebcdiccafr':
  483. return 'EBCDIC-CA-FR';
  484. case 'csebcdicdkno':
  485. case 'ebcdicdkno':
  486. return 'EBCDIC-DK-NO';
  487. case 'csebcdicdknoa':
  488. case 'ebcdicdknoa':
  489. return 'EBCDIC-DK-NO-A';
  490. case 'csebcdices':
  491. case 'ebcdices':
  492. return 'EBCDIC-ES';
  493. case 'csebcdicesa':
  494. case 'ebcdicesa':
  495. return 'EBCDIC-ES-A';
  496. case 'csebcdicess':
  497. case 'ebcdicess':
  498. return 'EBCDIC-ES-S';
  499. case 'csebcdicfise':
  500. case 'ebcdicfise':
  501. return 'EBCDIC-FI-SE';
  502. case 'csebcdicfisea':
  503. case 'ebcdicfisea':
  504. return 'EBCDIC-FI-SE-A';
  505. case 'csebcdicfr':
  506. case 'ebcdicfr':
  507. return 'EBCDIC-FR';
  508. case 'csebcdicit':
  509. case 'ebcdicit':
  510. return 'EBCDIC-IT';
  511. case 'csebcdicpt':
  512. case 'ebcdicpt':
  513. return 'EBCDIC-PT';
  514. case 'csebcdicuk':
  515. case 'ebcdicuk':
  516. return 'EBCDIC-UK';
  517. case 'csebcdicus':
  518. case 'ebcdicus':
  519. return 'EBCDIC-US';
  520. case 'csiso111ecmacyrillic':
  521. case 'ecmacyrillic':
  522. case 'isoir111':
  523. case 'koi8e':
  524. return 'ECMA-cyrillic';
  525. case 'csiso17spanish':
  526. case 'es':
  527. case 'iso646es':
  528. case 'isoir17':
  529. return 'ES';
  530. case 'csiso85spanish2':
  531. case 'es2':
  532. case 'iso646es2':
  533. case 'isoir85':
  534. return 'ES2';
  535. case 'cseucpkdfmtjapanese':
  536. case 'eucjp':
  537. case 'extendedunixcodepackedformatforjapanese':
  538. return 'EUC-JP';
  539. case 'cseucfixwidjapanese':
  540. case 'extendedunixcodefixedwidthforjapanese':
  541. return 'Extended_UNIX_Code_Fixed_Width_for_Japanese';
  542. case 'gb18030':
  543. return 'GB18030';
  544. case 'chinese':
  545. case 'cp936':
  546. case 'csgb2312':
  547. case 'csiso58gb231280':
  548. case 'gb2312':
  549. case 'gb231280':
  550. case 'gbk':
  551. case 'isoir58':
  552. case 'ms936':
  553. case 'windows936':
  554. return 'GBK';
  555. case 'cn':
  556. case 'csiso57gb1988':
  557. case 'gb198880':
  558. case 'iso646cn':
  559. case 'isoir57':
  560. return 'GB_1988-80';
  561. case 'csiso153gost1976874':
  562. case 'gost1976874':
  563. case 'isoir153':
  564. case 'stsev35888':
  565. return 'GOST_19768-74';
  566. case 'csiso150':
  567. case 'csiso150greekccitt':
  568. case 'greekccitt':
  569. case 'isoir150':
  570. return 'greek-ccitt';
  571. case 'csiso88greek7':
  572. case 'greek7':
  573. case 'isoir88':
  574. return 'greek7';
  575. case 'csiso18greek7old':
  576. case 'greek7old':
  577. case 'isoir18':
  578. return 'greek7-old';
  579. case 'cshpdesktop':
  580. case 'hpdesktop':
  581. return 'HP-DeskTop';
  582. case 'cshplegal':
  583. case 'hplegal':
  584. return 'HP-Legal';
  585. case 'cshpmath8':
  586. case 'hpmath8':
  587. return 'HP-Math8';
  588. case 'cshppifont':
  589. case 'hppifont':
  590. return 'HP-Pi-font';
  591. case 'cshproman8':
  592. case 'hproman8':
  593. case 'r8':
  594. case 'roman8':
  595. return 'hp-roman8';
  596. case 'hzgb2312':
  597. return 'HZ-GB-2312';
  598. case 'csibmsymbols':
  599. case 'ibmsymbols':
  600. return 'IBM-Symbols';
  601. case 'csibmthai':
  602. case 'ibmthai':
  603. return 'IBM-Thai';
  604. case 'cp37':
  605. case 'csibm37':
  606. case 'ebcdiccpca':
  607. case 'ebcdiccpnl':
  608. case 'ebcdiccpus':
  609. case 'ebcdiccpwt':
  610. case 'ibm37':
  611. return 'IBM037';
  612. case 'cp38':
  613. case 'csibm38':
  614. case 'ebcdicint':
  615. case 'ibm38':
  616. return 'IBM038';
  617. case 'cp273':
  618. case 'csibm273':
  619. case 'ibm273':
  620. return 'IBM273';
  621. case 'cp274':
  622. case 'csibm274':
  623. case 'ebcdicbe':
  624. case 'ibm274':
  625. return 'IBM274';
  626. case 'cp275':
  627. case 'csibm275':
  628. case 'ebcdicbr':
  629. case 'ibm275':
  630. return 'IBM275';
  631. case 'csibm277':
  632. case 'ebcdiccpdk':
  633. case 'ebcdiccpno':
  634. case 'ibm277':
  635. return 'IBM277';
  636. case 'cp278':
  637. case 'csibm278':
  638. case 'ebcdiccpfi':
  639. case 'ebcdiccpse':
  640. case 'ibm278':
  641. return 'IBM278';
  642. case 'cp280':
  643. case 'csibm280':
  644. case 'ebcdiccpit':
  645. case 'ibm280':
  646. return 'IBM280';
  647. case 'cp281':
  648. case 'csibm281':
  649. case 'ebcdicjpe':
  650. case 'ibm281':
  651. return 'IBM281';
  652. case 'cp284':
  653. case 'csibm284':
  654. case 'ebcdiccpes':
  655. case 'ibm284':
  656. return 'IBM284';
  657. case 'cp285':
  658. case 'csibm285':
  659. case 'ebcdiccpgb':
  660. case 'ibm285':
  661. return 'IBM285';
  662. case 'cp290':
  663. case 'csibm290':
  664. case 'ebcdicjpkana':
  665. case 'ibm290':
  666. return 'IBM290';
  667. case 'cp297':
  668. case 'csibm297':
  669. case 'ebcdiccpfr':
  670. case 'ibm297':
  671. return 'IBM297';
  672. case 'cp420':
  673. case 'csibm420':
  674. case 'ebcdiccpar1':
  675. case 'ibm420':
  676. return 'IBM420';
  677. case 'cp423':
  678. case 'csibm423':
  679. case 'ebcdiccpgr':
  680. case 'ibm423':
  681. return 'IBM423';
  682. case 'cp424':
  683. case 'csibm424':
  684. case 'ebcdiccphe':
  685. case 'ibm424':
  686. return 'IBM424';
  687. case '437':
  688. case 'cp437':
  689. case 'cspc8codepage437':
  690. case 'ibm437':
  691. return 'IBM437';
  692. case 'cp500':
  693. case 'csibm500':
  694. case 'ebcdiccpbe':
  695. case 'ebcdiccpch':
  696. case 'ibm500':
  697. return 'IBM500';
  698. case 'cp775':
  699. case 'cspc775baltic':
  700. case 'ibm775':
  701. return 'IBM775';
  702. case '850':
  703. case 'cp850':
  704. case 'cspc850multilingual':
  705. case 'ibm850':
  706. return 'IBM850';
  707. case '851':
  708. case 'cp851':
  709. case 'csibm851':
  710. case 'ibm851':
  711. return 'IBM851';
  712. case '852':
  713. case 'cp852':
  714. case 'cspcp852':
  715. case 'ibm852':
  716. return 'IBM852';
  717. case '855':
  718. case 'cp855':
  719. case 'csibm855':
  720. case 'ibm855':
  721. return 'IBM855';
  722. case '857':
  723. case 'cp857':
  724. case 'csibm857':
  725. case 'ibm857':
  726. return 'IBM857';
  727. case 'ccsid858':
  728. case 'cp858':
  729. case 'ibm858':
  730. case 'pcmultilingual850euro':
  731. return 'IBM00858';
  732. case '860':
  733. case 'cp860':
  734. case 'csibm860':
  735. case 'ibm860':
  736. return 'IBM860';
  737. case '861':
  738. case 'cp861':
  739. case 'cpis':
  740. case 'csibm861':
  741. case 'ibm861':
  742. return 'IBM861';
  743. case '862':
  744. case 'cp862':
  745. case 'cspc862latinhebrew':
  746. case 'ibm862':
  747. return 'IBM862';
  748. case '863':
  749. case 'cp863':
  750. case 'csibm863':
  751. case 'ibm863':
  752. return 'IBM863';
  753. case 'cp864':
  754. case 'csibm864':
  755. case 'ibm864':
  756. return 'IBM864';
  757. case '865':
  758. case 'cp865':
  759. case 'csibm865':
  760. case 'ibm865':
  761. return 'IBM865';
  762. case '866':
  763. case 'cp866':
  764. case 'csibm866':
  765. case 'ibm866':
  766. return 'IBM866';
  767. case 'cp868':
  768. case 'cpar':
  769. case 'csibm868':
  770. case 'ibm868':
  771. return 'IBM868';
  772. case '869':
  773. case 'cp869':
  774. case 'cpgr':
  775. case 'csibm869':
  776. case 'ibm869':
  777. return 'IBM869';
  778. case 'cp870':
  779. case 'csibm870':
  780. case 'ebcdiccproece':
  781. case 'ebcdiccpyu':
  782. case 'ibm870':
  783. return 'IBM870';
  784. case 'cp871':
  785. case 'csibm871':
  786. case 'ebcdiccpis':
  787. case 'ibm871':
  788. return 'IBM871';
  789. case 'cp880':
  790. case 'csibm880':
  791. case 'ebcdiccyrillic':
  792. case 'ibm880':
  793. return 'IBM880';
  794. case 'cp891':
  795. case 'csibm891':
  796. case 'ibm891':
  797. return 'IBM891';
  798. case 'cp903':
  799. case 'csibm903':
  800. case 'ibm903':
  801. return 'IBM903';
  802. case '904':
  803. case 'cp904':
  804. case 'csibbm904':
  805. case 'ibm904':
  806. return 'IBM904';
  807. case 'cp905':
  808. case 'csibm905':
  809. case 'ebcdiccptr':
  810. case 'ibm905':
  811. return 'IBM905';
  812. case 'cp918':
  813. case 'csibm918':
  814. case 'ebcdiccpar2':
  815. case 'ibm918':
  816. return 'IBM918';
  817. case 'ccsid924':
  818. case 'cp924':
  819. case 'ebcdiclatin9euro':
  820. case 'ibm924':
  821. return 'IBM00924';
  822. case 'cp1026':
  823. case 'csibm1026':
  824. case 'ibm1026':
  825. return 'IBM1026';
  826. case 'ibm1047':
  827. return 'IBM1047';
  828. case 'ccsid1140':
  829. case 'cp1140':
  830. case 'ebcdicus37euro':
  831. case 'ibm1140':
  832. return 'IBM01140';
  833. case 'ccsid1141':
  834. case 'cp1141':
  835. case 'ebcdicde273euro':
  836. case 'ibm1141':
  837. return 'IBM01141';
  838. case 'ccsid1142':
  839. case 'cp1142':
  840. case 'ebcdicdk277euro':
  841. case 'ebcdicno277euro':
  842. case 'ibm1142':
  843. return 'IBM01142';
  844. case 'ccsid1143':
  845. case 'cp1143':
  846. case 'ebcdicfi278euro':
  847. case 'ebcdicse278euro':
  848. case 'ibm1143':
  849. return 'IBM01143';
  850. case 'ccsid1144':
  851. case 'cp1144':
  852. case 'ebcdicit280euro':
  853. case 'ibm1144':
  854. return 'IBM01144';
  855. case 'ccsid1145':
  856. case 'cp1145':
  857. case 'ebcdices284euro':
  858. case 'ibm1145':
  859. return 'IBM01145';
  860. case 'ccsid1146':
  861. case 'cp1146':
  862. case 'ebcdicgb285euro':
  863. case 'ibm1146':
  864. return 'IBM01146';
  865. case 'ccsid1147':
  866. case 'cp1147':
  867. case 'ebcdicfr297euro':
  868. case 'ibm1147':
  869. return 'IBM01147';
  870. case 'ccsid1148':
  871. case 'cp1148':
  872. case 'ebcdicinternational500euro':
  873. case 'ibm1148':
  874. return 'IBM01148';
  875. case 'ccsid1149':
  876. case 'cp1149':
  877. case 'ebcdicis871euro':
  878. case 'ibm1149':
  879. return 'IBM01149';
  880. case 'csiso143iecp271':
  881. case 'iecp271':
  882. case 'isoir143':
  883. return 'IEC_P27-1';
  884. case 'csiso49inis':
  885. case 'inis':
  886. case 'isoir49':
  887. return 'INIS';
  888. case 'csiso50inis8':
  889. case 'inis8':
  890. case 'isoir50':
  891. return 'INIS-8';
  892. case 'csiso51iniscyrillic':
  893. case 'iniscyrillic':
  894. case 'isoir51':
  895. return 'INIS-cyrillic';
  896. case 'csinvariant':
  897. case 'invariant':
  898. return 'INVARIANT';
  899. case 'iso2022cn':
  900. return 'ISO-2022-CN';
  901. case 'iso2022cnext':
  902. return 'ISO-2022-CN-EXT';
  903. case 'csiso2022jp':
  904. case 'iso2022jp':
  905. return 'ISO-2022-JP';
  906. case 'csiso2022jp2':
  907. case 'iso2022jp2':
  908. return 'ISO-2022-JP-2';
  909. case 'csiso2022kr':
  910. case 'iso2022kr':
  911. return 'ISO-2022-KR';
  912. case 'cswindows30latin1':
  913. case 'iso88591windows30latin1':
  914. return 'ISO-8859-1-Windows-3.0-Latin-1';
  915. case 'cswindows31latin1':
  916. case 'iso88591windows31latin1':
  917. return 'ISO-8859-1-Windows-3.1-Latin-1';
  918. case 'csisolatin2':
  919. case 'iso88592':
  920. case 'iso885921987':
  921. case 'isoir101':
  922. case 'l2':
  923. case 'latin2':
  924. return 'ISO-8859-2';
  925. case 'cswindows31latin2':
  926. case 'iso88592windowslatin2':
  927. return 'ISO-8859-2-Windows-Latin-2';
  928. case 'csisolatin3':
  929. case 'iso88593':
  930. case 'iso885931988':
  931. case 'isoir109':
  932. case 'l3':
  933. case 'latin3':
  934. return 'ISO-8859-3';
  935. case 'csisolatin4':
  936. case 'iso88594':
  937. case 'iso885941988':
  938. case 'isoir110':
  939. case 'l4':
  940. case 'latin4':
  941. return 'ISO-8859-4';
  942. case 'csisolatincyrillic':
  943. case 'cyrillic':
  944. case 'iso88595':
  945. case 'iso885951988':
  946. case 'isoir144':
  947. return 'ISO-8859-5';
  948. case 'arabic':
  949. case 'asmo708':
  950. case 'csisolatinarabic':
  951. case 'ecma114':
  952. case 'iso88596':
  953. case 'iso885961987':
  954. case 'isoir127':
  955. return 'ISO-8859-6';
  956. case 'csiso88596e':
  957. case 'iso88596e':
  958. return 'ISO-8859-6-E';
  959. case 'csiso88596i':
  960. case 'iso88596i':
  961. return 'ISO-8859-6-I';
  962. case 'csisolatingreek':
  963. case 'ecma118':
  964. case 'elot928':
  965. case 'greek':
  966. case 'greek8':
  967. case 'iso88597':
  968. case 'iso885971987':
  969. case 'isoir126':
  970. return 'ISO-8859-7';
  971. case 'csisolatinhebrew':
  972. case 'hebrew':
  973. case 'iso88598':
  974. case 'iso885981988':
  975. case 'isoir138':
  976. return 'ISO-8859-8';
  977. case 'csiso88598e':
  978. case 'iso88598e':
  979. return 'ISO-8859-8-E';
  980. case 'csiso88598i':
  981. case 'iso88598i':
  982. return 'ISO-8859-8-I';
  983. case 'cswindows31latin5':
  984. case 'iso88599windowslatin5':
  985. return 'ISO-8859-9-Windows-Latin-5';
  986. case 'csisolatin6':
  987. case 'iso885910':
  988. case 'iso8859101992':
  989. case 'isoir157':
  990. case 'l6':
  991. case 'latin6':
  992. return 'ISO-8859-10';
  993. case 'iso885913':
  994. return 'ISO-8859-13';
  995. case 'iso885914':
  996. case 'iso8859141998':
  997. case 'isoceltic':
  998. case 'isoir199':
  999. case 'l8':
  1000. case 'latin8':
  1001. return 'ISO-8859-14';
  1002. case 'iso885915':
  1003. case 'latin9':
  1004. return 'ISO-8859-15';
  1005. case 'iso885916':
  1006. case 'iso8859162001':
  1007. case 'isoir226':
  1008. case 'l10':
  1009. case 'latin10':
  1010. return 'ISO-8859-16';
  1011. case 'iso10646j1':
  1012. return 'ISO-10646-J-1';
  1013. case 'csunicode':
  1014. case 'iso10646ucs2':
  1015. return 'ISO-10646-UCS-2';
  1016. case 'csucs4':
  1017. case 'iso10646ucs4':
  1018. return 'ISO-10646-UCS-4';
  1019. case 'csunicodeascii':
  1020. case 'iso10646ucsbasic':
  1021. return 'ISO-10646-UCS-Basic';
  1022. case 'csunicodelatin1':
  1023. case 'iso10646':
  1024. case 'iso10646unicodelatin1':
  1025. return 'ISO-10646-Unicode-Latin1';
  1026. case 'csiso10646utf1':
  1027. case 'iso10646utf1':
  1028. return 'ISO-10646-UTF-1';
  1029. case 'csiso115481':
  1030. case 'iso115481':
  1031. case 'isotr115481':
  1032. return 'ISO-11548-1';
  1033. case 'csiso90':
  1034. case 'isoir90':
  1035. return 'iso-ir-90';
  1036. case 'csunicodeibm1261':
  1037. case 'isounicodeibm1261':
  1038. return 'ISO-Unicode-IBM-1261';
  1039. case 'csunicodeibm1264':
  1040. case 'isounicodeibm1264':
  1041. return 'ISO-Unicode-IBM-1264';
  1042. case 'csunicodeibm1265':
  1043. case 'isounicodeibm1265':
  1044. return 'ISO-Unicode-IBM-1265';
  1045. case 'csunicodeibm1268':
  1046. case 'isounicodeibm1268':
  1047. return 'ISO-Unicode-IBM-1268';
  1048. case 'csunicodeibm1276':
  1049. case 'isounicodeibm1276':
  1050. return 'ISO-Unicode-IBM-1276';
  1051. case 'csiso646basic1983':
  1052. case 'iso646basic1983':
  1053. case 'ref':
  1054. return 'ISO_646.basic:1983';
  1055. case 'csiso2intlrefversion':
  1056. case 'irv':
  1057. case 'iso646irv1983':
  1058. case 'isoir2':
  1059. return 'ISO_646.irv:1983';
  1060. case 'csiso2033':
  1061. case 'e13b':
  1062. case 'iso20331983':
  1063. case 'isoir98':
  1064. return 'ISO_2033-1983';
  1065. case 'csiso5427cyrillic':
  1066. case 'iso5427':
  1067. case 'isoir37':
  1068. return 'ISO_5427';
  1069. case 'iso5427cyrillic1981':
  1070. case 'iso54271981':
  1071. case 'isoir54':
  1072. return 'ISO_5427:1981';
  1073. case 'csiso5428greek':
  1074. case 'iso54281980':
  1075. case 'isoir55':
  1076. return 'ISO_5428:1980';
  1077. case 'csiso6937add':
  1078. case 'iso6937225':
  1079. case 'isoir152':
  1080. return 'ISO_6937-2-25';
  1081. case 'csisotextcomm':
  1082. case 'iso69372add':
  1083. case 'isoir142':
  1084. return 'ISO_6937-2-add';
  1085. case 'csiso8859supp':
  1086. case 'iso8859supp':
  1087. case 'isoir154':
  1088. case 'latin125':
  1089. return 'ISO_8859-supp';
  1090. case 'csiso10367box':
  1091. case 'iso10367box':
  1092. case 'isoir155':
  1093. return 'ISO_10367-box';
  1094. case 'csiso15italian':
  1095. case 'iso646it':
  1096. case 'isoir15':
  1097. case 'it':
  1098. return 'IT';
  1099. case 'csiso13jisc6220jp':
  1100. case 'isoir13':
  1101. case 'jisc62201969':
  1102. case 'jisc62201969jp':
  1103. case 'katakana':
  1104. case 'x2017':
  1105. return 'JIS_C6220-1969-jp';
  1106. case 'csiso14jisc6220ro':
  1107. case 'iso646jp':
  1108. case 'isoir14':
  1109. case 'jisc62201969ro':
  1110. case 'jp':
  1111. return 'JIS_C6220-1969-ro';
  1112. case 'csiso42jisc62261978':
  1113. case 'isoir42':
  1114. case 'jisc62261978':
  1115. return 'JIS_C6226-1978';
  1116. case 'csiso87jisx208':
  1117. case 'isoir87':
  1118. case 'jisc62261983':
  1119. case 'jisx2081983':
  1120. case 'x208':
  1121. return 'JIS_C6226-1983';
  1122. case 'csiso91jisc62291984a':
  1123. case 'isoir91':
  1124. case 'jisc62291984a':
  1125. case 'jpocra':
  1126. return 'JIS_C6229-1984-a';
  1127. case 'csiso92jisc62991984b':
  1128. case 'iso646jpocrb':
  1129. case 'isoir92':
  1130. case 'jisc62291984b':
  1131. case 'jpocrb':
  1132. return 'JIS_C6229-1984-b';
  1133. case 'csiso93jis62291984badd':
  1134. case 'isoir93':
  1135. case 'jisc62291984badd':
  1136. case 'jpocrbadd':
  1137. return 'JIS_C6229-1984-b-add';
  1138. case 'csiso94jis62291984hand':
  1139. case 'isoir94':
  1140. case 'jisc62291984hand':
  1141. case 'jpocrhand':
  1142. return 'JIS_C6229-1984-hand';
  1143. case 'csiso95jis62291984handadd':
  1144. case 'isoir95':
  1145. case 'jisc62291984handadd':
  1146. case 'jpocrhandadd':
  1147. return 'JIS_C6229-1984-hand-add';
  1148. case 'csiso96jisc62291984kana':
  1149. case 'isoir96':
  1150. case 'jisc62291984kana':
  1151. return 'JIS_C6229-1984-kana';
  1152. case 'csjisencoding':
  1153. case 'jisencoding':
  1154. return 'JIS_Encoding';
  1155. case 'cshalfwidthkatakana':
  1156. case 'jisx201':
  1157. case 'x201':
  1158. return 'JIS_X0201';
  1159. case 'csiso159jisx2121990':
  1160. case 'isoir159':
  1161. case 'jisx2121990':
  1162. case 'x212':
  1163. return 'JIS_X0212-1990';
  1164. case 'csiso141jusib1002':
  1165. case 'iso646yu':
  1166. case 'isoir141':
  1167. case 'js':
  1168. case 'jusib1002':
  1169. case 'yu':
  1170. return 'JUS_I.B1.002';
  1171. case 'csiso147macedonian':
  1172. case 'isoir147':
  1173. case 'jusib1003mac':
  1174. case 'macedonian':
  1175. return 'JUS_I.B1.003-mac';
  1176. case 'csiso146serbian':
  1177. case 'isoir146':
  1178. case 'jusib1003serb':
  1179. case 'serbian':
  1180. return 'JUS_I.B1.003-serb';
  1181. case 'koi7switched':
  1182. return 'KOI7-switched';
  1183. case 'cskoi8r':
  1184. case 'koi8r':
  1185. return 'KOI8-R';
  1186. case 'koi8u':
  1187. return 'KOI8-U';
  1188. case 'csksc5636':
  1189. case 'iso646kr':
  1190. case 'ksc5636':
  1191. return 'KSC5636';
  1192. case 'cskz1048':
  1193. case 'kz1048':
  1194. case 'rk1048':
  1195. case 'strk10482002':
  1196. return 'KZ-1048';
  1197. case 'csiso19latingreek':
  1198. case 'isoir19':
  1199. case 'latingreek':
  1200. return 'latin-greek';
  1201. case 'csiso27latingreek1':
  1202. case 'isoir27':
  1203. case 'latingreek1':
  1204. return 'Latin-greek-1';
  1205. case 'csiso158lap':
  1206. case 'isoir158':
  1207. case 'lap':
  1208. case 'latinlap':
  1209. return 'latin-lap';
  1210. case 'csmacintosh':
  1211. case 'mac':
  1212. case 'macintosh':
  1213. return 'macintosh';
  1214. case 'csmicrosoftpublishing':
  1215. case 'microsoftpublishing':
  1216. return 'Microsoft-Publishing';
  1217. case 'csmnem':
  1218. case 'mnem':
  1219. return 'MNEM';
  1220. case 'csmnemonic':
  1221. case 'mnemonic':
  1222. return 'MNEMONIC';
  1223. case 'csiso86hungarian':
  1224. case 'hu':
  1225. case 'iso646hu':
  1226. case 'isoir86':
  1227. case 'msz77953':
  1228. return 'MSZ_7795.3';
  1229. case 'csnatsdano':
  1230. case 'isoir91':
  1231. case 'natsdano':
  1232. return 'NATS-DANO';
  1233. case 'csnatsdanoadd':
  1234. case 'isoir92':
  1235. case 'natsdanoadd':
  1236. return 'NATS-DANO-ADD';
  1237. case 'csnatssefi':
  1238. case 'isoir81':
  1239. case 'natssefi':
  1240. return 'NATS-SEFI';
  1241. case 'csnatssefiadd':
  1242. case 'isoir82':
  1243. case 'natssefiadd':
  1244. return 'NATS-SEFI-ADD';
  1245. case 'csiso151cuba':
  1246. case 'cuba':
  1247. case 'iso646cu':
  1248. case 'isoir151':
  1249. case 'ncnc1081':
  1250. return 'NC_NC00-10:81';
  1251. case 'csiso69french':
  1252. case 'fr':
  1253. case 'iso646fr':
  1254. case 'isoir69':
  1255. case 'nfz62010':
  1256. return 'NF_Z_62-010';
  1257. case 'csiso25french':
  1258. case 'iso646fr1':
  1259. case 'isoir25':
  1260. case 'nfz620101973':
  1261. return 'NF_Z_62-010_(1973)';
  1262. case 'csiso60danishnorwegian':
  1263. case 'csiso60norwegian1':
  1264. case 'iso646no':
  1265. case 'isoir60':
  1266. case 'no':
  1267. case 'ns45511':
  1268. return 'NS_4551-1';
  1269. case 'csiso61norwegian2':
  1270. case 'iso646no2':
  1271. case 'isoir61':
  1272. case 'no2':
  1273. case 'ns45512':
  1274. return 'NS_4551-2';
  1275. case 'osdebcdicdf3irv':
  1276. return 'OSD_EBCDIC_DF03_IRV';
  1277. case 'osdebcdicdf41':
  1278. return 'OSD_EBCDIC_DF04_1';
  1279. case 'osdebcdicdf415':
  1280. return 'OSD_EBCDIC_DF04_15';
  1281. case 'cspc8danishnorwegian':
  1282. case 'pc8danishnorwegian':
  1283. return 'PC8-Danish-Norwegian';
  1284. case 'cspc8turkish':
  1285. case 'pc8turkish':
  1286. return 'PC8-Turkish';
  1287. case 'csiso16portuguese':
  1288. case 'iso646pt':
  1289. case 'isoir16':
  1290. case 'pt':
  1291. return 'PT';
  1292. case 'csiso84portuguese2':
  1293. case 'iso646pt2':
  1294. case 'isoir84':
  1295. case 'pt2':
  1296. return 'PT2';
  1297. case 'cp154':
  1298. case 'csptcp154':
  1299. case 'cyrillicasian':
  1300. case 'pt154':
  1301. case 'ptcp154':
  1302. return 'PTCP154';
  1303. case 'scsu':
  1304. return 'SCSU';
  1305. case 'csiso10swedish':
  1306. case 'fi':
  1307. case 'iso646fi':
  1308. case 'iso646se':
  1309. case 'isoir10':
  1310. case 'se':
  1311. case 'sen850200b':
  1312. return 'SEN_850200_B';
  1313. case 'csiso11swedishfornames':
  1314. case 'iso646se2':
  1315. case 'isoir11':
  1316. case 'se2':
  1317. case 'sen850200c':
  1318. return 'SEN_850200_C';
  1319. case 'csiso102t617bit':
  1320. case 'isoir102':
  1321. case 't617bit':
  1322. return 'T.61-7bit';
  1323. case 'csiso103t618bit':
  1324. case 'isoir103':
  1325. case 't61':
  1326. case 't618bit':
  1327. return 'T.61-8bit';
  1328. case 'csiso128t101g2':
  1329. case 'isoir128':
  1330. case 't101g2':
  1331. return 'T.101-G2';
  1332. case 'cstscii':
  1333. case 'tscii':
  1334. return 'TSCII';
  1335. case 'csunicode11':
  1336. case 'unicode11':
  1337. return 'UNICODE-1-1';
  1338. case 'csunicode11utf7':
  1339. case 'unicode11utf7':
  1340. return 'UNICODE-1-1-UTF-7';
  1341. case 'csunknown8bit':
  1342. case 'unknown8bit':
  1343. return 'UNKNOWN-8BIT';
  1344. case 'ansix341968':
  1345. case 'ansix341986':
  1346. case 'ascii':
  1347. case 'cp367':
  1348. case 'csascii':
  1349. case 'ibm367':
  1350. case 'iso646irv1991':
  1351. case 'iso646us':
  1352. case 'isoir6':
  1353. case 'us':
  1354. case 'usascii':
  1355. return 'US-ASCII';
  1356. case 'csusdk':
  1357. case 'usdk':
  1358. return 'us-dk';
  1359. case 'utf7':
  1360. return 'UTF-7';
  1361. case 'utf8':
  1362. return 'UTF-8';
  1363. case 'utf16':
  1364. return 'UTF-16';
  1365. case 'utf16be':
  1366. return 'UTF-16BE';
  1367. case 'utf16le':
  1368. return 'UTF-16LE';
  1369. case 'utf32':
  1370. return 'UTF-32';
  1371. case 'utf32be':
  1372. return 'UTF-32BE';
  1373. case 'utf32le':
  1374. return 'UTF-32LE';
  1375. case 'csventurainternational':
  1376. case 'venturainternational':
  1377. return 'Ventura-International';
  1378. case 'csventuramath':
  1379. case 'venturamath':
  1380. return 'Ventura-Math';
  1381. case 'csventuraus':
  1382. case 'venturaus':
  1383. return 'Ventura-US';
  1384. case 'csiso70videotexsupp1':
  1385. case 'isoir70':
  1386. case 'videotexsuppl':
  1387. return 'videotex-suppl';
  1388. case 'csviqr':
  1389. case 'viqr':
  1390. return 'VIQR';
  1391. case 'csviscii':
  1392. case 'viscii':
  1393. return 'VISCII';
  1394. case 'csshiftjis':
  1395. case 'cswindows31j':
  1396. case 'mskanji':
  1397. case 'shiftjis':
  1398. case 'windows31j':
  1399. return 'Windows-31J';
  1400. case 'iso885911':
  1401. case 'tis620':
  1402. return 'windows-874';
  1403. case 'cseuckr':
  1404. case 'csksc56011987':
  1405. case 'euckr':
  1406. case 'isoir149':
  1407. case 'korean':
  1408. case 'ksc5601':
  1409. case 'ksc56011987':
  1410. case 'ksc56011989':
  1411. case 'windows949':
  1412. return 'windows-949';
  1413. case 'windows1250':
  1414. return 'windows-1250';
  1415. case 'windows1251':
  1416. return 'windows-1251';
  1417. case 'cp819':
  1418. case 'csisolatin1':
  1419. case 'ibm819':
  1420. case 'iso88591':
  1421. case 'iso885911987':
  1422. case 'isoir100':
  1423. case 'l1':
  1424. case 'latin1':
  1425. case 'windows1252':
  1426. return 'windows-1252';
  1427. case 'windows1253':
  1428. return 'windows-1253';
  1429. case 'csisolatin5':
  1430. case 'iso88599':
  1431. case 'iso885991989':
  1432. case 'isoir148':
  1433. case 'l5':
  1434. case 'latin5':
  1435. case 'windows1254':
  1436. return 'windows-1254';
  1437. case 'windows1255':
  1438. return 'windows-1255';
  1439. case 'windows1256':
  1440. return 'windows-1256';
  1441. case 'windows1257':
  1442. return 'windows-1257';
  1443. case 'windows1258':
  1444. return 'windows-1258';
  1445. default:
  1446. return $charset;
  1447. }
  1448. }
  1449. public static function get_curl_version()
  1450. {
  1451. if (is_array($curl = curl_version()))
  1452. {
  1453. $curl = $curl['version'];
  1454. }
  1455. elseif (substr($curl, 0, 5) === 'curl/')
  1456. {
  1457. $curl = substr($curl, 5, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 5));
  1458. }
  1459. elseif (substr($curl, 0, 8) === 'libcurl/')
  1460. {
  1461. $curl = substr($curl, 8, strcspn($curl, "\x09\x0A\x0B\x0C\x0D", 8));
  1462. }
  1463. else
  1464. {
  1465. $curl = 0;
  1466. }
  1467. return $curl;
  1468. }
  1469. public static function is_subclass_of($class1, $class2)
  1470. {
  1471. if (func_num_args() !== 2)
  1472. {
  1473. trigger_error('Wrong parameter count for SimplePie_Misc::is_subclass_of()', E_USER_WARNING);
  1474. }
  1475. elseif (version_compare(PHP_VERSION, '5.0.3', '>=') || is_object($class1))
  1476. {
  1477. return is_subclass_of($class1, $class2);
  1478. }
  1479. elseif (is_string($class1) && is_string($class2))
  1480. {
  1481. if (class_exists($class1))
  1482. {
  1483. if (class_exists($class2))
  1484. {
  1485. $class2 = strtolower($class2);
  1486. while ($class1 = strtolower(get_parent_class($class1)))
  1487. {
  1488. if ($class1 === $class2)
  1489. {
  1490. return true;
  1491. }
  1492. }
  1493. }
  1494. }
  1495. else
  1496. {
  1497. trigger_error('Unknown class passed as parameter', E_USER_WARNNG);
  1498. }
  1499. }
  1500. return false;
  1501. }
  1502. /**
  1503. * Strip HTML comments
  1504. *
  1505. * @param string $data Data to strip comments from
  1506. * @return string Comment stripped string
  1507. */
  1508. public static function strip_comments($data)
  1509. {
  1510. $output = '';
  1511. while (($start = strpos($data, '<!--')) !== false)
  1512. {
  1513. $output .= substr($data, 0, $start);
  1514. if (($end = strpos($data, '-->', $start)) !== false)
  1515. {
  1516. $data = substr_replace($data, '', 0, $end + 3);
  1517. }
  1518. else
  1519. {
  1520. $data = '';
  1521. }
  1522. }
  1523. return $output . $data;
  1524. }
  1525. public static function parse_date($dt)
  1526. {
  1527. $parser = SimplePie_Parse_Date::get();
  1528. return $parser->parse($dt);
  1529. }
  1530. /**
  1531. * Decode HTML entities
  1532. *
  1533. * @static
  1534. * @param string $data Input data
  1535. * @return string Output data
  1536. */
  1537. public static function entities_decode($data)
  1538. {
  1539. $decoder = new SimplePie_Decode_HTML_Entities($data);
  1540. return $decoder->parse();
  1541. }
  1542. /**
  1543. * Remove RFC822 comments
  1544. *
  1545. * @param string $data Data to strip comments from
  1546. * @return string Comment stripped string
  1547. */
  1548. public static function uncomment_rfc822($string)
  1549. {
  1550. $string = (string) $string;
  1551. $position = 0;
  1552. $length = strlen($string);
  1553. $depth = 0;
  1554. $output = '';
  1555. while ($position < $length && ($pos = strpos($string, '(', $position)) !== false)
  1556. {
  1557. $output .= substr($string, $position, $pos - $position);
  1558. $position = $pos + 1;
  1559. if ($string[$pos - 1] !== '\\')
  1560. {
  1561. $depth++;
  1562. while ($depth && $position < $length)
  1563. {
  1564. $position += strcspn($string, '()', $position);
  1565. if ($string[$position - 1] === '\\')
  1566. {
  1567. $position++;
  1568. continue;
  1569. }
  1570. elseif (isset($string[$position]))
  1571. {
  1572. switch ($string[$position])
  1573. {
  1574. case '(':
  1575. $depth++;
  1576. break;
  1577. case ')':
  1578. $depth--;
  1579. break;
  1580. }
  1581. $position++;
  1582. }
  1583. else
  1584. {
  1585. break;
  1586. }
  1587. }
  1588. }
  1589. else
  1590. {
  1591. $output .= '(';
  1592. }
  1593. }
  1594. $output .= substr($string, $position);
  1595. return $output;
  1596. }
  1597. public static function parse_mime($mime)
  1598. {
  1599. if (($pos = strpos($mime, ';')) === false)
  1600. {
  1601. return trim($mime);
  1602. }
  1603. else
  1604. {
  1605. return trim(substr($mime, 0, $pos));
  1606. }
  1607. }
  1608. public static function htmlspecialchars_decode($string, $quote_style)
  1609. {
  1610. if (function_exists('htmlspecialchars_decode'))
  1611. {
  1612. return htmlspecialchars_decode($string, $quote_style);
  1613. }
  1614. else
  1615. {
  1616. return strtr($string, array_flip(get_html_translation_table(HTML_SPECIALCHARS, $quote_style)));
  1617. }
  1618. }
  1619. public static function atom_03_construct_type($attribs)
  1620. {
  1621. if (isset($attribs['']['mode']) && strtolower(trim($attribs['']['mode']) === 'base64'))
  1622. {
  1623. $mode = SIMPLEPIE_CONSTRUCT_BASE64;
  1624. }
  1625. else
  1626. {
  1627. $mode = SIMPLEPIE_CONSTRUCT_NONE;
  1628. }
  1629. if (isset($attribs['']['type']))
  1630. {
  1631. switch (strtolower(trim($attribs['']['type'])))
  1632. {
  1633. case 'text':
  1634. case 'text/plain':
  1635. return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
  1636. case 'html':
  1637. case 'text/html':
  1638. return SIMPLEPIE_CONSTRUCT_HTML | $mode;
  1639. case 'xhtml':
  1640. case 'application/xhtml+xml':
  1641. return SIMPLEPIE_CONSTRUCT_XHTML | $mode;
  1642. default:
  1643. return SIMPLEPIE_CONSTRUCT_NONE | $mode;
  1644. }
  1645. }
  1646. else
  1647. {
  1648. return SIMPLEPIE_CONSTRUCT_TEXT | $mode;
  1649. }
  1650. }
  1651. public static function atom_10_construct_type($attribs)
  1652. {
  1653. if (isset($attribs['']['type']))
  1654. {
  1655. switch (strtolower(trim($attribs['']['type'])))
  1656. {
  1657. case 'text':
  1658. return SIMPLEPIE_CONSTRUCT_TEXT;
  1659. case 'html':
  1660. return SIMPLEPIE_CONSTRUCT_HTML;
  1661. case 'xhtml':
  1662. return SIMPLEPIE_CONSTRUCT_XHTML;
  1663. default:
  1664. return SIMPLEPIE_CONSTRUCT_NONE;
  1665. }
  1666. }
  1667. return SIMPLEPIE_CONSTRUCT_TEXT;
  1668. }
  1669. public static function atom_10_content_construct_type($attribs)
  1670. {
  1671. if (isset($attribs['']['type']))
  1672. {
  1673. $type = strtolower(trim($attribs['']['type']));
  1674. switch ($type)
  1675. {
  1676. case 'text':
  1677. return SIMPLEPIE_CONSTRUCT_TEXT;
  1678. case 'html':
  1679. return SIMPLEPIE_CONSTRUCT_HTML;
  1680. case 'xhtml':
  1681. return SIMPLEPIE_CONSTRUCT_XHTML;
  1682. }
  1683. if (in_array(substr($type, -4), array('+xml', '/xml')) || substr($type, 0, 5) === 'text/')
  1684. {
  1685. return SIMPLEPIE_CONSTRUCT_NONE;
  1686. }
  1687. else
  1688. {
  1689. return SIMPLEPIE_CONSTRUCT_BASE64;
  1690. }
  1691. }
  1692. else
  1693. {
  1694. return SIMPLEPIE_CONSTRUCT_TEXT;
  1695. }
  1696. }
  1697. public static function is_isegment_nz_nc($string)
  1698. {
  1699. return (bool) preg_match('/^([A-Za-z0-9\-._~\x{A0}-\x{D7FF}\x{F900}-\x{FDCF}\x{FDF0}-\x{FFEF}\x{10000}-\x{1FFFD}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}\x{40000}-\x{4FFFD}\x{50000}-\x{5FFFD}\x{60000}-\x{6FFFD}\x{70000}-\x{7FFFD}\x{80000}-\x{8FFFD}\x{90000}-\x{9FFFD}\x{A0000}-\x{AFFFD}\x{B0000}-\x{BFFFD}\x{C0000}-\x{CFFFD}\x{D0000}-\x{DFFFD}\x{E1000}-\x{EFFFD}!$&\'()*+,;=@]|(%[0-9ABCDEF]{2}))+$/u', $string);
  1700. }
  1701. public static function space_seperated_tokens($string)
  1702. {
  1703. $space_characters = "\x20\x09\x0A\x0B\x0C\x0D";
  1704. $string_length = strlen($string);
  1705. $position = strspn($string, $space_characters);
  1706. $tokens = array();
  1707. while ($position < $string_length)
  1708. {
  1709. $len = strcspn($string, $space_characters, $position);
  1710. $tokens[] = substr($string, $position, $len);
  1711. $position += $len;
  1712. $position += strspn($string, $space_characters, $position);
  1713. }
  1714. return $tokens;
  1715. }
  1716. public static function array_unique($array)
  1717. {
  1718. if (version_compare(PHP_VERSION, '5.2', '>='))
  1719. {
  1720. return array_unique($array);
  1721. }
  1722. else
  1723. {
  1724. $array = (array) $array;
  1725. $new_array = array();
  1726. $new_array_strings = array();
  1727. foreach ($array as $key => $value)
  1728. {
  1729. if (is_object($value))
  1730. {
  1731. if (method_exists($value, '__toString'))
  1732. {
  1733. $cmp = $value->__toString();
  1734. }
  1735. else
  1736. {
  1737. trigger_error('Object of class ' . get_class($value) . ' could not be converted to string', E_USER_ERROR);
  1738. }
  1739. }
  1740. elseif (is_array($value))
  1741. {
  1742. $cmp = (string) reset($value);
  1743. }
  1744. else
  1745. {
  1746. $cmp = (string) $value;
  1747. }
  1748. if (!in_array($cmp, $new_array_strings))
  1749. {
  1750. $new_array[$key] = $value;
  1751. $new_array_strings[] = $cmp;
  1752. }
  1753. }
  1754. return $new_array;
  1755. }
  1756. }
  1757. /**
  1758. * Converts a unicode codepoint to a UTF-8 character
  1759. *
  1760. * @static
  1761. * @param int $codepoint Unicode codepoint
  1762. * @return string UTF-8 character
  1763. */
  1764. public static function codepoint_to_utf8($codepoint)
  1765. {
  1766. $codepoint = (int) $codepoint;
  1767. if ($codepoint < 0)
  1768. {
  1769. return false;
  1770. }
  1771. else if ($codepoint <= 0x7f)
  1772. {
  1773. return chr($codepoint);
  1774. }
  1775. else if ($codepoint <= 0x7ff)
  1776. {
  1777. return chr(0xc0 | ($codepoint >> 6)) . chr(0x80 | ($codepoint & 0x3f));
  1778. }
  1779. else if ($codepoint <= 0xffff)
  1780. {
  1781. return chr(0xe0 | ($codepoint >> 12)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
  1782. }
  1783. else if ($codepoint <= 0x10ffff)
  1784. {
  1785. return chr(0xf0 | ($codepoint >> 18)) . chr(0x80 | (($codepoint >> 12) & 0x3f)) . chr(0x80 | (($codepoint >> 6) & 0x3f)) . chr(0x80 | ($codepoint & 0x3f));
  1786. }
  1787. else
  1788. {
  1789. // U+FFFD REPLACEMENT CHARACTER
  1790. return "\xEF\xBF\xBD";
  1791. }
  1792. }
  1793. /**
  1794. * Similar to parse_str()
  1795. *
  1796. * Returns an associative array of name/value pairs, where the value is an
  1797. * array of values that have used the same name
  1798. *
  1799. * @static
  1800. * @param string $str The input string.
  1801. * @return array
  1802. */
  1803. public static function parse_str($str)
  1804. {
  1805. $return = array();
  1806. $str = explode('&', $str);
  1807. foreach ($str as $section)
  1808. {
  1809. if (strpos($section, '=') !== false)
  1810. {
  1811. list($name, $value) = explode('=', $section, 2);
  1812. $return[urldecode($name)][] = urldecode($value);
  1813. }
  1814. else
  1815. {
  1816. $return[urldecode($section)][] = null;
  1817. }
  1818. }
  1819. return $return;
  1820. }
  1821. /**
  1822. * Detect XML encoding, as per XML 1.0 Appendix F.1
  1823. *
  1824. * @todo Add support for EBCDIC
  1825. * @param string $data XML data
  1826. * @return array Possible encodings
  1827. */
  1828. public static function xml_encoding($data)
  1829. {
  1830. // UTF-32 Big Endian BOM
  1831. if (substr($data, 0, 4) === "\x00\x00\xFE\xFF")
  1832. {
  1833. $encoding[] = 'UTF-32BE';
  1834. }
  1835. // UTF-32 Little Endian BOM
  1836. elseif (substr($data, 0, 4) === "\xFF\xFE\x00\x00")
  1837. {
  1838. $encoding[] = 'UTF-32LE';
  1839. }
  1840. // UTF-16 Big Endian BOM
  1841. elseif (substr($data, 0, 2) === "\xFE\xFF")
  1842. {
  1843. $encoding[] = 'UTF-16BE';
  1844. }
  1845. // UTF-16 Little Endian BOM
  1846. elseif (substr($data, 0, 2) === "\xFF\xFE")
  1847. {
  1848. $encoding[] = 'UTF-16LE';
  1849. }
  1850. // UTF-8 BOM
  1851. elseif (substr($data, 0, 3) === "\xEF\xBB\xBF")
  1852. {
  1853. $encoding[] = 'UTF-8';
  1854. }
  1855. // UTF-32 Big Endian Without BOM
  1856. elseif (substr($data, 0, 20) === "\x00\x00\x00\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C")
  1857. {
  1858. if ($pos = strpos($data, "\x00\x00\x00\x3F\x00\x00\x00\x3E"))
  1859. {
  1860. $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32BE', 'UTF-8'));
  1861. if ($parser->parse())
  1862. {
  1863. $encoding[] = $parser->encoding;
  1864. }
  1865. }
  1866. $encoding[] = 'UTF-32BE';
  1867. }
  1868. // UTF-32 Little Endian Without BOM
  1869. elseif (substr($data, 0, 20) === "\x3C\x00\x00\x00\x3F\x00\x00\x00\x78\x00\x00\x00\x6D\x00\x00\x00\x6C\x00\x00\x00")
  1870. {
  1871. if ($pos = strpos($data, "\x3F\x00\x00\x00\x3E\x00\x00\x00"))
  1872. {
  1873. $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 20), 'UTF-32LE', 'UTF-8'));
  1874. if ($parser->parse())
  1875. {
  1876. $encoding[] = $parser->encoding;
  1877. }
  1878. }
  1879. $encoding[] = 'UTF-32LE';
  1880. }
  1881. // UTF-16 Big Endian Without BOM
  1882. elseif (substr($data, 0, 10) === "\x00\x3C\x00\x3F\x00\x78\x00\x6D\x00\x6C")
  1883. {
  1884. if ($pos = strpos($data, "\x00\x3F\x00\x3E"))
  1885. {
  1886. $parser = new SimplePie_XML_Declaration_Parser(SimplePie_Misc::change_encoding(substr($data, 20, $pos - 10), 'UTF-16BE', 'UTF-8'));
  1887. if ($parser->parse())
  1888. {

Large files files are truncated, but you can click here to view the full file