Index: trunk/phase3/includes/WebRequest.php |
— | — | @@ -220,10 +220,13 @@ |
221 | 221 | */ |
222 | 222 | function getGPCVal( $arr, $name, $default ) { |
223 | 223 | if( isset( $arr[$name] ) ) { |
| 224 | + global $wgContLang; |
224 | 225 | $data = $arr[$name]; |
225 | 226 | if( isset( $_GET[$name] ) && !is_array( $data ) ) { |
226 | 227 | # Check for alternate/legacy character encoding. |
227 | | - $data = $this->checkTitleEncoding( $data ); |
| 228 | + if( isset( $wgContLang ) ) { |
| 229 | + $data = $wgContLang->checkTitleEncoding( $data ); |
| 230 | + } |
228 | 231 | } |
229 | 232 | $data = $this->normalizeUnicode( $data ); |
230 | 233 | return $data; |
— | — | @@ -231,21 +234,7 @@ |
232 | 235 | return $default; |
233 | 236 | } |
234 | 237 | } |
235 | | - |
236 | | - protected function checkTitleEncoding( $s ) { |
237 | | - global $wgContLang; |
238 | | - if( !isset($wgContLang) ) return $s; |
239 | | - # Check for non-UTF-8 URLs |
240 | | - $ishigh = preg_match( '/[\x80-\xff]/', $s); |
241 | | - if( !$ishigh ) return $s; |
242 | 238 | |
243 | | - $isutf8 = preg_match( '/^([\x00-\x7f]|[\xc0-\xdf][\x80-\xbf]|' . |
244 | | - '[\xe0-\xef][\x80-\xbf]{2}|[\xf0-\xf7][\x80-\xbf]{3})+$/', $s ); |
245 | | - if( $isutf8 ) return $s; |
246 | | - # Do the heavy lifting by unstubbing $wgContLang |
247 | | - return $wgContLang->iconv( $wgContLang->fallback8bitEncoding(), "utf-8", $s ); |
248 | | - } |
249 | | - |
250 | 239 | /** |
251 | 240 | * Fetch a scalar from the input or return $default if it's not set. |
252 | 241 | * Returns a string. Arrays are discarded. Useful for |