Welcome Guest, Not a member yet? Register   Sign In
zip library - CR/LF when adding file data
#1

[eluser]Unknown[/eluser]
hi all

I'm using the zip library in a CI project where one of the requirements is to produce a zip file containing a C header file.

everything works fine, except the normal carriage returns in the text file generate are pulled through as literals (\r\n or \n)

example:

$name = "filename.h";
$data = "first line of data here\n";
$data .= "second line of data here\n";

$this->zip->add_data($name, $data);

$this->zip->download('file.zip');

the resulting .h file has the literal \n in it rather than a CR/LF - any idea what the best way to handle this would be?




Theme © iAndrew 2016 - Forum software by © MyBB