mabog Posted January 15, 2012 Share Posted January 15, 2012 Hello. Trying to get rid a line feed which is coming from a excel cell which has Text and a line feed after that word. After the excel file has been saved-as tab-delimited, that text transforms to this: "Text" That line feed is between t and the last double-quote. Hex viewer shows: 22 54 65 78 74 0A 22 so it must be that 0A. I have tried with trim() and with str_replace("\x0A","",$data) but nothing (like \r or \n) works. How do I get rid of that hidden character? Is that \x0A correct? Quote Link to comment https://forums.phpfreaks.com/topic/255083-excel-and-a-cell-with-a-line-feed-how-to-remove-it/ Share on other sites More sharing options...
mabog Posted January 16, 2012 Author Share Posted January 16, 2012 Found the problem. Data (where those 0As are) is a tab-delimited text file created by excel. That line feed is confusing file handling when trying to get data one row at a time with fgets(). It acts like 0A is a new row.. Tried to add ini_set('auto_detect_line_endings', true); before fopen(), but no change. So those characters would be needed to remove BEFORE the file is opened. And that, I think, is impossible since files might be quite big.. Going through the file one character at a time for 0A's, is slow... So it's easier to ask users to remove word warp (that, i belive, is creating 0As) from the excel file before uploading it to my page. No can do. Quote Link to comment https://forums.phpfreaks.com/topic/255083-excel-and-a-cell-with-a-line-feed-how-to-remove-it/#findComment-1308133 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.