graphonline/wiki/scripts/xlpage-iso-8859-2.php
2017-04-15 01:34:36 +03:00

66 lines
2.8 KiB
PHP
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php if (!defined('PmWiki')) exit();
/* Copyright 2004-2011 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.
*/
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);
}