Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezcharsetinfo.php
Go to the documentation of this file.
1 <?php
25 class eZCharsetInfo
26 {
32 static function &aliasTable()
33 {
34 $aliasTable =& $GLOBALS['eZCharsetInfoTable'];
35 if ( !is_array( $aliasTable ) )
36 {
37 $aliasTable = array( 'ascii' => 'us-ascii',
38 'latin1' => 'iso-8859-1',
39 'latin2' => 'iso-8859-2',
40 'latin3' => 'iso-8859-3',
41 'latin4' => 'iso-8859-4',
42 'latin5' => 'iso-8859-9',
43 'latin6' => 'iso-8859-10',
44 'latin7' => 'iso-8859-13',
45 'latin8' => 'iso-8859-14',
46 'latin9' => 'iso-8859-15',
47 'cyrillic' => 'iso-8859-5',
48 'arabic' => 'iso-8859-6',
49 'greek' => 'iso-8859-7',
50 'hebrew' => 'iso-8859-8',
51 'thai' => 'iso-8859-11',
52
53 'koi8-r' => 'koi8-r',
54 'koi-8-r' => 'koi8-r',
55 'koi8r' => 'koi8-r',
56
57 'koi8-u' => 'koi8-u',
58 'koi-8-u' => 'koi8-u',
59 'koi8u' => 'koi8-u',
60
61 'cp1250' => 'windows-1250',
62 'cp1251' => 'windows-1251',
63 'cp1252' => 'windows-1252',
64 'cp1253' => 'windows-1253',
65 'cp1254' => 'windows-1254',
66 'cp1255' => 'windows-1255',
67 'cp1256' => 'windows-1256',
68 'cp1257' => 'windows-1257',
69 'cp1258' => 'windows-1258',
70 'winlatin1' => 'windows-1252',
71 'winlatin2' => 'windows-1250',
72 'wincyrillic' => 'windows-1251',
73 'wingreek' => 'windows-1253',
74 'winturkish' => 'windows-1254',
75 'winhebrew' => 'windows-1255',
76 'winarabic' => 'windows-1256',
77 'winbaltic' => 'windows-1257',
78 'winvietnamese' => 'windows-1258',
79
80 'doslatinus' => 'cp437',
81 'dosgreek' => 'cp737',
82 'dosbaltrim' => 'cp775',
83 'doslatin1' => 'cp850',
84 'doslatin2' => 'cp852',
85 'doscyrillic' => 'cp855',
86 'dosturkish' => 'cp857',
87 'dosportuguese' => 'cp860',
88 'dosicelandic' => 'cp861',
89 'doshebrew' => 'cp862',
90 'doscanadaf' => 'cp863',
91 'dosarabic' => 'cp864',
92 'dosnordic' => 'cp865',
93 'dosgreek2' => 'cp869',
94 'doscyrillicrussian' => 'cp866',
95 'dosthai' => 'cp874',
96
97 'macroman' => 'macintosh',
98 'nextstep' => 'next',
99
100 'utf8' => 'utf-8',
101 'utf7' => 'utf-7',
102
103 'utf16' => 'utf-16',
104 'utf16be' => 'utf-16be',
105 'utf16le' => 'utf-16le',
106
107 'utf32' => 'utf-32',
108 'utf32be' => 'utf-32be',
109 'utf32le' => 'utf-32le',
110
111 'ucs4' => 'ucs-4',
112 'ucs4be' => 'ucs-4be',
113 'ucs4le' => 'ucs-4le',
114
115 'ucs2' => 'ucs-2',
116 'ucs2be' => 'ucs-2be',
117 'ucs2le' => 'ucs-2le',
118
119 'shift-jis' => 'cp932',
120 'gbk' => 'gbk',
121 'euc-cn' => 'euc-cn',
122 'unifiedhangul' => 'cp849',
123 'uhc' => 'cp849',
124 'big5' => 'cp850'
125 );
126 for ( $i = 1; $i <= 15; ++$i )
127 {
128 $aliasTable["iso8859-$i"] = "iso-8859-$i";
129 $aliasTable["iso8859$i"] = "iso-8859-$i";
130 }
131 $aliasTable['unicode'] = 'unicode';
132 }
133 return $aliasTable;
134 }
135
143 static function &encodingTable()
144 {
145 $encodingTable =& $GLOBALS['eZCharsetInfoEncodingTable'];
146 if ( !is_array( $encodingTable ) )
147 {
148 $encodingTable = array( 'doublebyte' => array( 'cp932',
149 'GBK',
150 'euc-cn',
151 'cp849',
152 'cp850' ),
153 'unicode' => array( 'unicode' ),
154 'utf-8' => array( 'utf-8', 'utf8mb4' ) );
155 }
156 return $encodingTable;
157 }
158
166 static function &reverseEncodingTable()
167 {
168 $reverseEncodingTable =& $GLOBALS['eZCharsetInfoReverseEncodingTable'];
169 if ( !is_array( $reverseEncodingTable ) )
170 {
171 $encodingTable =& eZCharsetInfo::encodingTable();
172 $reverseEncodingTable = array();
173 foreach( $encodingTable as $encodingScheme => $charsetMatches )
174 {
175 foreach( $charsetMatches as $charsetMatch )
176 $reverseEncodingTable[$charsetMatch] = $encodingScheme;
177 }
178 }
179 return $reverseEncodingTable;
180 }
181
187 static function realCharsetCode( $charsetCode )
188 {
189 $aliasTable =& eZCharsetInfo::aliasTable();
190 $charsetCode = strtolower( $charsetCode );
191 if ( isset( $aliasTable[$charsetCode] ) )
192 return $aliasTable[$charsetCode];
193 // Check alias without any dashes
194 $charsetCodeNoDash = str_replace( '-', '', $charsetCode );
195 if ( isset( $aliasTable[$charsetCodeNoDash] ) )
196 return $aliasTable[$charsetCodeNoDash];
197 return $charsetCode;
198 }
199
207 static function characterEncodingScheme( $charsetCode, $isRealCharset = false )
208 {
209 if ( !$isRealCharset )
210 $charsetCode = eZCharsetInfo::realCharsetCode( $charsetCode );
211 $reverseEncodingTable =& eZCharsetInfo::reverseEncodingTable();
212 if ( isset( $reverseEncodingTable[$charsetCode] ) )
213 return $reverseEncodingTable[$charsetCode];
214 return 'singlebyte';
215 }
216 }
217
218 ?>
$i
$i
Definition: admin/adlist.php:91
eZCharsetInfo
Allows for quering information about charsets.
Definition: ezcharsetinfo.php:26
eZCharsetInfo\aliasTable
static & aliasTable()
Definition: ezcharsetinfo.php:32
eZCharsetInfo\realCharsetCode
static realCharsetCode( $charsetCode)
Definition: ezcharsetinfo.php:187
eZCharsetInfo\characterEncodingScheme
static characterEncodingScheme( $charsetCode, $isRealCharset=false)
Definition: ezcharsetinfo.php:207
eZCharsetInfo\encodingTable
static & encodingTable()
Definition: ezcharsetinfo.php:143
eZCharsetInfo\reverseEncodingTable
static & reverseEncodingTable()
Definition: ezcharsetinfo.php:166
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.