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 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); 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 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! 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> 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
Archived
This topic is now archived and is closed to further replies.