CodeIgniter Forums
Possible codeigniter bug in the HTTP body response - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Possible codeigniter bug in the HTTP body response (/thread-59040.html)



Possible codeigniter bug in the HTTP body response - El Forum - 08-17-2013

[eluser]Raff_Gh[/eluser]
Do any of you know why codeigniter prefixes three characters \r (or \0 I didn't figure out) to the body of any HTTP response?

When it comes to using ajax it's causing me going mad beacuase ajax string cannot be parsed properly... To solve temporarily the situation I did the following :

Echoing ajax this way :
Code:
-{"hello":"world"}

and then retrieve this data in the following way:

Code:
var data1 = data.split("-");

alert(data1[0]);// this prints \r\r\r
alert(data1[1]);// this prints {"hello":"world"}


var data1 = JSON.parse(data1[1]);


But I leave you judge the cleaness of this solution... anyone has any clue why this error occurs with CI ?


Possible codeigniter bug in the HTTP body response - El Forum - 08-18-2013

[eluser]Raff_Gh[/eluser]
what I'm asking is, what may cause "/r/r/r" or maybe (/n/n/n) to be output before the actual output of the controller may it be a view or an echo statement,
maybe somethin is messed up in my config files, or something like that?


Possible codeigniter bug in the HTTP body response - El Forum - 08-18-2013

[eluser]NeoArc[/eluser]
Start a native session, it may tell you the file and line where the output begins


Possible codeigniter bug in the HTTP body response - El Forum - 08-19-2013

[eluser]Raff_Gh[/eluser]
I've already tried this and no error occurs.

code:

Code:
session_start();
echo "hello world!";
return;



Possible codeigniter bug in the HTTP body response - El Forum - 08-21-2013

[eluser]Raff_Gh[/eluser]
OK, solved.
The problem was caused by the Unix to dos converter I was forced to use to read some of the
files in the project and this messed things up.