diff --git a/admin/check/check_api.php b/admin/check/check_api.php index 85f7648be1..b4b91ac59e 100644 --- a/admin/check/check_api.php +++ b/admin/check/check_api.php @@ -265,3 +265,12 @@ function check_print_test_warn_row( $p_description, $p_pass, $p_info = null ) { $g_alternate_row = $g_alternate_row === 1 ? 2 : 1; return $p_pass; } + +/** + * Verifies that the given collation is UTF-8 + * @param string $p_collation + * @return boolean True if UTF-8 + */ +function check_is_collation_utf8( $p_collation ) { + return substr( $p_collation, 0, 4 ) === 'utf8'; +} diff --git a/admin/check/check_database_inc.php b/admin/check/check_database_inc.php index a6d6c0871c..88b4292f7d 100644 --- a/admin/check/check_database_inc.php +++ b/admin/check/check_database_inc.php @@ -364,7 +364,7 @@ ) { check_print_test_row( 'Table ' . htmlentities( $t_row['name'] ) . ' is using UTF-8 collation', - substr( $t_row['collation'], 0, 5 ) === 'utf8_', + check_is_collation_utf8( $t_row['collation'] ), array( false => 'Table ' . htmlentities( $t_row['name'] ) . ' is using ' . htmlentities( $t_row['collation'] ) . ' collation where UTF-8 collation is required.' ) ); @@ -383,7 +383,7 @@ . ' of type ' . $t_row['type'] . ' on table ' . htmlentities( $t_table ) . ' is is using UTF-8 collation', - substr( $t_row['collation'], 0, 5 ) === 'utf8_', + check_is_collation_utf8( $t_row['collation'] ), array( false => 'Text column ' . htmlentities( $t_row['field'] ) . ' of type ' . $t_row['type'] . ' on table ' . htmlentities( $t_table )