Creating import file on Windows results in non-importable import-file #1351

Closed
UnderDogg opened this Issue Apr 26, 2012 · 1 comment

Comments

Projects
None yet
2 participants

When you create an import file using the Porter plugin (or even Porter Plus) a file is correctly created.
(.txt.gz file). Inside those .txt files the lines are terminated by the '\n' character

The problem is that on Windows the lines should be terminated by the '\r\n' characters.

Problematic code is:
class.importmodel.php lines 977-985:

  $Sql = "load data infile $Path into table $Tablename
     character set utf8
     columns terminated by ','
     optionally enclosed by '\"'
     escaped by '\\\\'
     lines terminated by '\\n'
     ignore 1 lines";
  $this->Query($Sql);

}

Extra information : in the top of the file, where the constants are defined, the following constant is defined too:
const NEWLINE = "\n";

Maybe Windows OS could be detected and this constant could be used in the SQL query from lines 977-985

Workaround :
Changing lines terminated by '\n' to lines terminated by '\r\n' solved the problem for me.

Owner

linc commented Nov 24, 2012

FYI, that bug tracker is over here: https://github.com/lincolnwebs/VanillaPorter/issues

I'll cross-post.

linc referenced this issue in vanilla/porter Nov 24, 2012

Closed

Windows line breaks #15

linc closed this Mar 14, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment