Skip byte order marks (bug #1423362).
This commit is contained in:
@@ -16,6 +16,7 @@ $Source$
|
|||||||
* libraries/iconv_wrapper.lib.php, libraries/charset_conversion.lib.php,
|
* libraries/iconv_wrapper.lib.php, libraries/charset_conversion.lib.php,
|
||||||
libraries/database_interface.lib.php: Compatibility with iconv charset
|
libraries/database_interface.lib.php: Compatibility with iconv charset
|
||||||
names on AIX (patch #1420704, thanks to Björn Wiberg - bwiberg).
|
names on AIX (patch #1420704, thanks to Björn Wiberg - bwiberg).
|
||||||
|
* libraries/import.lib.php: Skip byte order marks (bug #1423362).
|
||||||
|
|
||||||
2006-02-21 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
2006-02-21 Sebastian Mendel <cybot_tm@users.sourceforge.net>
|
||||||
* libraries/common.lib.php PMA_getUvaCondition():
|
* libraries/common.lib.php PMA_getUvaCondition():
|
||||||
|
@@ -251,6 +251,19 @@ function PMA_importGetNextChunk($size = 32768)
|
|||||||
if ($charset_conversion) {
|
if ($charset_conversion) {
|
||||||
return PMA_convert_string($charset_of_file, $charset, $result);
|
return PMA_convert_string($charset_of_file, $charset, $result);
|
||||||
} else {
|
} else {
|
||||||
|
// Skip possible byte order marks (I do not think we need more
|
||||||
|
// charsets, but feel free to add more, you can use wikipedia for
|
||||||
|
// reference: <http://en.wikipedia.org/wiki/Byte_Order_Mark>)
|
||||||
|
// @TODO: BOM could be used for charset autodetection
|
||||||
|
if ($offset == $size) {
|
||||||
|
// UTF-8
|
||||||
|
if (strncmp($result, "\xEF\xBB\xBF", 3) == 0) {
|
||||||
|
$result = substr($result, 3);
|
||||||
|
// UTF-16 BE, LE
|
||||||
|
} elseif (strncmp($result, "\xFE\xFF", 2) == 0 || strncmp($result, "\xFF\xFE", 2) == 0) {
|
||||||
|
$result = substr($result, 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user