Re: Removing a return character

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



John Nichel wrote:
Greg Donald wrote:

On Fri, 10 Dec 2004 10:10:20 -0000, Shaun <shaunthornburgh@xxxxxxxxxxx> wrote:

I have a system that scans through a CSV File and inserts each row into a
database. I have just noticed that some rows have a return character in
them - a small square - and this is causing errors in the mysql query.


Does anyone know how I can remove such chracters?



You can use one of the string replacement functions, eregi_replace() for example. If you're sure it's a return character then \r is what you want to replace, or it might possibly be \r\n.



rtrim() will take care of all return characters at the end of the line, as well as white space. The 'small square' could be something else...some special character.


in windows systems the 'small square' usually actually is a UNIX (or MacOS) LF char.

UNIX systems use \n, MacOS uses \r and windows uses \r\n. A couple of native windows apps don't understand any other return characters than '\r\n', so when a single \n or a single \r appears, those apps will have no idea what it is, and will show such a square.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux