1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- <?php if (!defined('PmWiki')) exit();
- /* Copyright 2004-2017 Patrick R. Michaud (pmichaud@pobox.com)
- This file is part of PmWiki; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version. See pmwiki.php for full details.
- This file is used to enable the iso-8859-2 character set in PmWiki.
- The first part converts the charset to iso-8859-2 and removes
- conflicts for newline and keep tokens; the second part
- handles the conversion of pagenames from utf-8 (sent by browsers)
- into iso-8859-2 if needed.
-
- Script maintained by Petko YOTOV www.pmwiki.org/petko
- */
- global $HTTPHeaders, $pagename, $KeepToken, $Charset, $DefaultPageCharset;
- $HTTPHeaders[] = "Content-Type: text/html; charset=iso-8859-2";
- $Charset = "ISO-8859-2";
- SDVA($DefaultPageCharset, array('ISO-8859-1'=>$Charset));
- $KeepToken = "\263\263\263";
- $pagename = $_REQUEST['n'];
- if (!$pagename) $pagename = @$_GET['pagename'];
- if ($pagename=='' && $EnablePathInfo)
- $pagename = @substr($_SERVER['PATH_INFO'],1);
- if (!$pagename &&
- preg_match('!^'.preg_quote($_SERVER['SCRIPT_NAME'],'!').'/?([^?]*)!',
- $_SERVER['REQUEST_URI'],$match))
- $pagename = urldecode($match[1]);
- $pagename = preg_replace('!/+$!','',$pagename);
- if (!preg_match('/[\\x80-\\x9f]/', $pagename)) return;
- if (function_exists('iconv'))
- $pagename = iconv('UTF-8','ISO-8859-2',$pagename);
- else {
- $conv = array(
- ' '=>' ', 'Ä„'=>'¡', '˘'=>'¢', 'Å�'=>'£',
- '¤'=>'¤', 'Ľ'=>'¥', 'Åš'=>'¦', '§'=>'§',
- '¨'=>'¨', 'Å '=>'©', 'Åž'=>'ª', 'Ť'=>'«',
- 'Ź'=>'¬', 'Â'=>'', 'Ž'=>'®', 'Å»'=>'¯',
- '°'=>'°', 'Ä…'=>'±', 'Ë›'=>'²', 'Å‚'=>'³',
- '´'=>'´', 'ľ'=>'µ', 'Å›'=>'¶', 'ˇ'=>'·',
- '¸'=>'¸', 'Å¡'=>'¹', 'ÅŸ'=>'º', 'Å¥'=>'»',
- 'ź'=>'¼', 'Ë�'=>'½', 'ž'=>'¾', 'ż'=>'¿',
- 'Å”'=>'À', 'Ã�'=>'Á', 'Â'=>'Â', 'Ä‚'=>'Ã',
- 'Ä'=>'Ä', 'Ĺ'=>'Å', 'Ć'=>'Æ', 'Ç'=>'Ç',
- 'ÄŒ'=>'È', 'É'=>'É', 'Ę'=>'Ê', 'Ë'=>'Ë',
- 'Äš'=>'Ì', 'Ã�'=>'Í', 'ÃŽ'=>'Î', 'ÄŽ'=>'Ï',
- 'Ä�'=>'Ð', 'Ń'=>'Ñ', 'Ň'=>'Ò', 'Ó'=>'Ó',
- 'Ô'=>'Ô', 'Å�'=>'Õ', 'Ö'=>'Ö', '×'=>'×',
- 'Ř'=>'Ø', 'Å®'=>'Ù', 'Ú'=>'Ú', 'Å°'=>'Û',
- 'Ãœ'=>'Ü', 'Ã�'=>'Ý', 'Å¢'=>'Þ', 'ß'=>'ß',
- 'Å•'=>'à', 'á'=>'á', 'â'=>'â', 'ă'=>'ã',
- 'ä'=>'ä', 'ĺ'=>'å', 'ć'=>'æ', 'ç'=>'ç',
- 'Ä�'=>'è', 'é'=>'é', 'Ä™'=>'ê', 'ë'=>'ë',
- 'Ä›'=>'ì', 'Ã'=>'í', 'î'=>'î', 'Ä�'=>'ï',
- 'Ä‘'=>'ð', 'Å„'=>'ñ', 'ň'=>'ò', 'ó'=>'ó',
- 'ô'=>'ô', 'Å‘'=>'õ', 'ö'=>'ö', '÷'=>'÷',
- 'Å™'=>'ø', 'ů'=>'ù', 'ú'=>'ú', 'ű'=>'û',
- 'ü'=>'ü', 'ý'=>'ý', 'Å£'=>'þ', 'Ë™'=>'ÿ',
- );
- $pagename = str_replace(array_keys($conv),array_values($conv),$pagename);
- }
|