00001 <?php
00002
00007 class LanguageEo extends Language {
00008 function iconv( $in, $out, $string ) {
00009 # Por multaj lingvoj, ĉi tiu nur voku la sisteman funkcion iconv()
00010 # Ni ankaŭ konvertu X-sistemajn surogotajn
00011 if( strcasecmp( $in, 'x' ) == 0 and strcasecmp( $out, 'utf-8' ) == 0) {
00012 $xu = array (
00013 'xx' => 'x' , 'xX' => 'x' ,
00014 'Xx' => 'X' , 'XX' => 'X' ,
00015 "Cx" => "\xc4\x88" , "CX" => "\xc4\x88" ,
00016 "cx" => "\xc4\x89" , "cX" => "\xc4\x89" ,
00017 "Gx" => "\xc4\x9c" , "GX" => "\xc4\x9c" ,
00018 "gx" => "\xc4\x9d" , "gX" => "\xc4\x9d" ,
00019 "Hx" => "\xc4\xa4" , "HX" => "\xc4\xa4" ,
00020 "hx" => "\xc4\xa5" , "hX" => "\xc4\xa5" ,
00021 "Jx" => "\xc4\xb4" , "JX" => "\xc4\xb4" ,
00022 "jx" => "\xc4\xb5" , "jX" => "\xc4\xb5" ,
00023 "Sx" => "\xc5\x9c" , "SX" => "\xc5\x9c" ,
00024 "sx" => "\xc5\x9d" , "sX" => "\xc5\x9d" ,
00025 "Ux" => "\xc5\xac" , "UX" => "\xc5\xac" ,
00026 "ux" => "\xc5\xad" , "uX" => "\xc5\xad"
00027 ) ;
00028 return preg_replace ( '/([cghjsu]x?)((?:xx)*)(?!x)/ei',
00029 'strtr( "$1", $xu ) . strtr( "$2", $xu )', $string );
00030 } else if( strcasecmp( $in, 'UTF-8' ) == 0 and strcasecmp( $out, 'x' ) == 0 ) {
00031 $ux = array (
00032 'x' => 'xx' , 'X' => 'Xx' ,
00033 "\xc4\x88" => "Cx" , "\xc4\x89" => "cx" ,
00034 "\xc4\x9c" => "Gx" , "\xc4\x9d" => "gx" ,
00035 "\xc4\xa4" => "Hx" , "\xc4\xa5" => "hx" ,
00036 "\xc4\xb4" => "Jx" , "\xc4\xb5" => "jx" ,
00037 "\xc5\x9c" => "Sx" , "\xc5\x9d" => "sx" ,
00038 "\xc5\xac" => "Ux" , "\xc5\xad" => "ux"
00039 ) ;
00040 # Double Xs only if they follow cxapelutaj literoj.
00041 return preg_replace( '/((?:[cghjsu]|\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
00042 '|\xc5[\x9c\x9d\xac\xad])x*)/ei', 'strtr( "$1", $ux )', $string );
00043 }
00044 return parent::iconv( $in, $out, $string );
00045 }
00046
00047 function checkTitleEncoding( $s ) {
00048 # Check for X-system backwards-compatibility URLs
00049 $ishigh = preg_match( '/[\x80-\xff]/', $s);
00050 $isutf = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' .
00051 '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s );
00052
00053 if($ishigh and !$isutf) {
00054 # Assume Latin1
00055 $s = utf8_encode( $s );
00056 } else {
00057 if( preg_match( '/(\xc4[\x88\x89\x9c\x9d\xa4\xa5\xb4\xb5]'.
00058 '|\xc5[\x9c\x9d\xac\xad])/', $s ) )
00059 return $s;
00060 }
00061
00062
00063
00064 return $s;
00065 }
00066
00067 function initEncoding() {
00068 global $wgEditEncoding;
00069 $wgEditEncoding = 'x';
00070 }
00071 }