r102326 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r102325‎ | r102326 | r102327 >
Date:21:10, 7 November 2011
Author:yaron
Status:deferred
Tags:
Comment:
Follow-up to r93180 - fixed handling if mb_detect_encoding() function does not exist
Modified paths:
  • /trunk/extensions/ExternalData/ED_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ExternalData/ED_Utils.php
@@ -193,7 +193,7 @@
194194 );
195195 } else {
196196 if ( ( $db_flags !== DBO_DEFAULT ) || ( $db_tableprefix !== '' ) ) {
197 - print wfMsg( "externaldata-db-option-unsupported", '<code>$edgDBFlags</code>', '<code>$edgDBTablePrefix</code>' );
 197+ print wfMsg( "externaldata-db-option-unsupported", '<code>$edgDBFlags</code>', '<code>$edgDBTablePrefix</code>' );
198198 return;
199199 }
200200
@@ -262,11 +262,12 @@
263263 // if necessary - based on code at
264264 // http://www.php.net/manual/en/function.mb-detect-encoding.php#102510
265265 $dbField = $row[$i];
266 - if ( mb_detect_encoding( $dbField, 'UTF-8', true ) == 'UTF-8' ) {
267 - $new_row[$column_name] = $dbField;
268 - } else {
269 - $new_row[$column_name] = utf8_encode( $dbField );
270 - }
 266+ if ( !function_exists( 'mb_detect_encoding' ) ||
 267+ mb_detect_encoding( $dbField, 'UTF-8', true ) == 'UTF-8' ) {
 268+ $new_row[$column_name] = $dbField;
 269+ } else {
 270+ $new_row[$column_name] = utf8_encode( $dbField );
 271+ }
271272 }
272273 $rows[] = $new_row;
273274 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r93180Changed DB retrieval code to detect whether DB data is in UTF-8 encoding alre...yaron14:22, 26 July 2011

Status & tagging log