]> git.joonet.de Git - adminer.git/commitdiff
Verify UTF-8 encoding of CSV import
authorJakub Vrana <jakub@vrana.cz>
Mon, 3 Jun 2013 21:57:26 +0000 (14:57 -0700)
committerJakub Vrana <jakub@vrana.cz>
Mon, 3 Jun 2013 21:57:26 +0000 (14:57 -0700)
adminer/lang/cs.inc.php
adminer/lang/xx.inc.php
adminer/select.inc.php
changes.txt
todo.txt

index 6742a23d1a2d489996d1e510026faf39f347f5fd..cb40f20ee81142b25ac3a4ba358124c8ee46b34d 100644 (file)
@@ -240,6 +240,7 @@ $translations = array(
        
        'Import' => 'Import',
        '%d row(s) have been imported.' => array('Byl importován %d záznam.', 'Byly importovány %d záznamy.', 'Bylo importováno %d záznamů.'),
+       'File must be in UTF-8 encoding.' => 'Soubor musí být v kódování UTF-8.',
        
        // in-place editing in select
        'Ctrl+click on a value to modify it.' => 'Ctrl+klikněte na políčko, které chcete změnit.',
index 709b8dd2980fc8ecf899fa7d35832b750c7f056e..a100759bfacdf466f1b0075eb1b230cc4535020c 100644 (file)
@@ -240,6 +240,7 @@ $translations = array(
        
        'Import' => 'xx',
        '%d row(s) have been imported.' => array('xx', 'xx'),
+       'File must be in UTF-8 encoding.' => 'xx',
        
        // in-place editing in select
        'Ctrl+click on a value to modify it.' => 'xx',
index 11552517c14ee4b67c1322a759169bc4e03a6e35..8b4b2296fcedbae8ee36f271b02178515fd87f3a 100644 (file)
@@ -158,8 +158,11 @@ if ($_POST && !$error) {
                                queries_redirect(remove_from_uri(), lang('%d item(s) have been affected.', $affected), $result);
                        }
                        
-               } elseif (is_string($file = get_file("csv_file", true))) {
-                       //! character set
+               } elseif (!is_string($file = get_file("csv_file", true))) {
+                       $error = upload_error($file);
+               } elseif (!preg_match('~~u', $file)) {
+                       $error = lang('File must be in UTF-8 encoding.');
+               } else {
                        cookie("adminer_import", "output=" . urlencode($adminer_import["output"]) . "&format=" . urlencode($_POST["separator"]));
                        $result = true;
                        $cols = array_keys($fields);
@@ -190,8 +193,6 @@ if ($_POST && !$error) {
                        queries_redirect(remove_from_uri("page"), lang('%d row(s) have been imported.', $affected), $result);
                        queries("ROLLBACK"); // after queries_redirect() to not overwrite error
                        
-               } else {
-                       $error = upload_error($file);
                }
        }
 }
index e47094d70837ffa4690e9a203e960bf39517537e..a65716fc764df8cc2a8f7ad69caaa04f79763a1b 100644 (file)
@@ -4,6 +4,7 @@ Use shadow for highlighting default button
 Don't use LIMIT 1 if inline updating unique row
 Don't check previous checkbox on added column in create table (bug #3614245)
 Order table list by name
+Verify UTF-8 encoding of CSV import
 PostgreSQL: Fix detecting oid column in PDO
 PostgreSQL: Handle timestamp types (bug #3614086)
 Add Korean translation
index 6adabfebb6b58443d3303889d320936b4602ae28..5e04a7bf5d28d3687aae4273db053609d325b0b5 100644 (file)
--- a/todo.txt
+++ b/todo.txt
@@ -21,7 +21,7 @@ Rank, Tree structure
 
 MySQL:
 Data longer than max_allowed_packet can be sent by mysqli_stmt_send_long_data()
-? Geometry support
+COLLATE utf8_bin comparison doesn't use index with other than UTF-8 columns
 
 SQLite:
 Copy tables