Menu

#390 (ok 2.11.4) CSV Escape character not exported right

closed-accepted
1
2008-01-12
2008-01-01
No

For the fonction export CSV, it seems that it does not respect the format generated by SELECT ... INTO file ... NOR the one expected by LOAD DATA ... in regards of the escape character.

Here is my exemple :
id name
1 my\value

File generated by :
- Export phpmyadmin CSV (params ';','"','\','\r\n')is :
"1";"my\value"

- Export with mysql SELECT .. INTO file (same params) is :
"1";"my\\value"

Then when this file is importing with LOAD DATA ... (same params)
- The phpmyadmin file gives :
id name
1 myvalue

- The mysql SELECT ... INTO file gives :
id name
1 my\value
Which is correct.

This is the case since at least version 2.6.1 to 2.11.3. So I really wonder is it a normal behaviour or not?

Anyhow the fix that may be needed could be in libraries/export/csv.php line 163 as in pma 2.6.1
str_replace($enclosed, $escaped . $enclosed, $row[$j])
changed by
str_replace($enclosed, $escaped . $enclosed, str_replace($escaped, $escaped . $escaped, $row[$j]) )

Discussion

  • XHearder

    XHearder - 2008-01-01

    Logged In: YES
    user_id=336851
    Originator: NO

    This is at line 183 in 2.11.3 same issue the fixed is the same.

     
  • Marc Delisle

    Marc Delisle - 2008-01-02

    Logged In: YES
    user_id=210714
    Originator: NO

    Moved to patches.

     
  • Marc Delisle

    Marc Delisle - 2008-01-02
    • milestone: 784091 -->
    • labels: 546627 --> Data Export
     
  • Marc Delisle

    Marc Delisle - 2008-01-02
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2008-01-02

    Logged In: YES
    user_id=210714
    Originator: NO

    Merged in subversion, thanks.

     
  • Marc Delisle

    Marc Delisle - 2008-01-02
    • milestone: --> For_immediate_release
    • priority: 5 --> 1
    • summary: CSV Escape character not exported right --> (ok 2.11.4) CSV Escape character not exported right
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2008-01-12
    • status: open-accepted --> closed-accepted