note 88126 added to function.htmlspecialchars-decode

From: Date: Mon, 12 Jan 2009 08:55:41 +0000
Subject: note 88126 added to function.htmlspecialchars-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-149081@lists.php.net to get a copy of this message
Not sure if this is a bug so just posting it as a note: When you have data in your (Mysql) db encoded with htmlspecialchars() and you want to retrieve the data for example to create a csv / xls file and the file should contain the decoded data, you can't use htmlspecialchars_decode() as this function creates some 'invisible' newlines which messes up the columns in your file (doesn't matter if you use tab delimited or ';' delimited). I tried filtering the data before and after the use of htmlspecialchars_decode() using: str_replace("\n","", $col1); str_replace("\r\n","", $col1); but this does not make any difference. I solved the problem by manually decoding everything that htmlspecialchars() encodes using str_replace() and everything works fine without any strange invisible newlines b.r. (ps Running php5; no similiar bug reports found in bug search) ---- Server IP: 117.55.229.1 Probable Submitter: 60.242.4.94 ---- Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars-decode.php Edit -- https://master.php.net/note/edit/88126 Del: integrated -- https://master.php.net/note/delete/88126/integrated Del: useless -- https://master.php.net/note/delete/88126/useless Del: bad code -- https://master.php.net/note/delete/88126/bad+code Del: spam -- https://master.php.net/note/delete/88126/spam Del: non-english -- https://master.php.net/note/delete/88126/non-english Del: in docs -- https://master.php.net/note/delete/88126/in+docs Del: other reasons-- https://master.php.net/note/delete/88126 Reject -- https://master.php.net/note/reject/88126 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149081) next »