grozanc Posted August 1, 2012 Share Posted August 1, 2012 Hello Everyone, I have a pdf that is automatically generated, unfortunately it's pulling ascii codes from the database and displaying them as ascii. I want to use the html_entity_decode() command to make the ascii display as the actual symbol (in my case a trade mark symbol instead of ™). Here is the line of code the outputs the information from the database $prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name']; My question is where would I wrap the html_entity_decode() around to change products[$i]['name'] from ascii to text? Thanks, Gary Link to comment https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/ Share on other sites More sharing options...
grozanc Posted August 2, 2012 Author Share Posted August 2, 2012 Anyone have any ideas or do I need to supply more info Link to comment https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/#findComment-1366336 Share on other sites More sharing options...
Christian F. Posted August 6, 2012 Share Posted August 6, 2012 Have you tried adding the function call around the variable you want to decode? Link to comment https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/#findComment-1367098 Share on other sites More sharing options...
ManiacDan Posted August 6, 2012 Share Posted August 6, 2012 You would wrap the function around the variable just as you've provided them. Take the function, put it around the variable. Link to comment https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/#findComment-1367137 Share on other sites More sharing options...
grozanc Posted August 7, 2012 Author Share Posted August 7, 2012 OK, I've tried the following and nothing seems to work. Can anyone spot what I'm doing wrong. I'm a newb when it comes to PHP so I don't expect that I'm doing this right. Please let me know if I'm not giving you enough information to be able to help. $prod_str = $order->products[$i]['qty'] . " x " . $order->html_entity_decode(products[$i]['name']); Page Load Error $prod_str = $order->products[$i]['qty'] . " x " . html_entity_decode($order->products[$i]['name']); Page renders but ascii character aren't converted. html_entity_decode($prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name']); Page renders but ascii character aren't converted. $prod_str = $order->products[$i]['qty'] . " x " . $order->products[$i]['name']; $prod_str = html_entity_decode($prod_str); Page renders but ascii character aren't converted. Link to comment https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/#findComment-1367574 Share on other sites More sharing options...
Christian F. Posted August 8, 2012 Share Posted August 8, 2012 Hmm... Could you post an example of the content with the erroneous data, as well as the result of the following snippet? var_dump ($order->products[$i]); die (); Just add it directly above or after the snippet you have posted in your previous post, and use "show (page) source" to fetch the raw output for us. Link to comment https://forums.phpfreaks.com/topic/266574-html_entity_decode-help/#findComment-1367663 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.