the_oliver Posted May 11, 2007 Share Posted May 11, 2007 Hello, I have a problem where text is stored in a database. When the text is extracted via a query the £ charictor comes up as strange charictors in some browsers. I tried header("Content-Type: text/html; charset=utf-8"); but that just change the browsers which had the problems! What i was wondering was wheter i could scearch throught the data returned from the query, and replace any £ with the html code for £? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/50918-converting-charictor-after-db-query/ Share on other sites More sharing options...
ToonMariner Posted May 11, 2007 Share Posted May 11, 2007 you can (and I suggest you do it on data going IN to the database rather than on out.) $str = preg_replace('/£/','$pound;',$str); Quote Link to comment https://forums.phpfreaks.com/topic/50918-converting-charictor-after-db-query/#findComment-250423 Share on other sites More sharing options...
jitesh Posted May 11, 2007 Share Posted May 11, 2007 instead of £ store "£" in DB Quote Link to comment https://forums.phpfreaks.com/topic/50918-converting-charictor-after-db-query/#findComment-250424 Share on other sites More sharing options...
the_oliver Posted May 11, 2007 Author Share Posted May 11, 2007 The trouble with that is that when the user goes to edit the content again they will see £ not £. Will try these, and see what happens. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/50918-converting-charictor-after-db-query/#findComment-250435 Share on other sites More sharing options...
jitesh Posted May 11, 2007 Share Posted May 11, 2007 Need to Print like this <td><?php echo "£";</td> or $currency = "£"; <td><?php echo $currency;</td> Quote Link to comment https://forums.phpfreaks.com/topic/50918-converting-charictor-after-db-query/#findComment-250436 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.