I have this
which is extracted from a server log
When I save this $data in a file using
In my data file I have lines like these
? which could be the cause
At a guess, I’d say this is a character encoding issue (these are commonly seen if you transfer between Linux and Windows systems).
Have a look into http://uk.php.net/mb_convert_encoding.
Still no solution , really lost.
Are the odd characters being introduced from the log read or the file_put_contents?
Have you checked that data doesn’t contain any hidden characters (which come from character encoding differences)? It looks to me like the characters you’re seeing (^[0;10m^[39;49m) represent whitespace in the string, but without having access to the specifics of your problem, such as server setup, log file type, …, I can’t help any further.
before executing this
I echo the data using this
and I receive this
which is correct .
If I save it on file , is all messed up .