![]() |
shot me - html isn't decode - WHY? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: shot me - html isn't decode - WHY? (/showthread.php?tid=33108) |
shot me - html isn't decode - WHY? - El Forum - 08-16-2010 [eluser]Jan_1[/eluser] getting really mad... could you please help me? my input in input field is ' รถ ' for example. so I get an ' & o u m l ; ' in my db-table-field. that's correct. but I don't get it decoded back. not with or without html_entity_decode(). it just gives me ' & o u m l ; ' back. am I blind? why that suddendly? view Code: <?php echo html_entity_decode($profil->detail); ?> Code: <input type='text' name='detail' value="<?php echo set_value('detail', $profil->detail); ?>"> model Code: $update['detail'] = htmlentities($this->input->post('detail')); db Code: `detail` text collate utf8_unicode_ci NOT NULL, shot me - html isn't decode - WHY? - El Forum - 08-16-2010 [eluser]mddd[/eluser] Suggestion 1: Don't store your information in html encoding in the database. Why? My opinion is you should only encode it when applicable. That is, when you ouput it into a html page. If you need the information for some other purpose, it is clumsy if it is already encoded. As you are experiencing right now. Suggestion 2: If you do want to encode/decode, make sure you specify the character set as the third parameter in the function, e.g. $encoded = htmlentities($string, ENT_COMPAT, 'UTF-8'); |