July 8, 201214 yr Hello, I have an input field which fetches information from the database which a user can update, if i put the £ sign in the field though and click update it will show £, i have mysqli_real_escape_string() on all things sent to the db i have tried putting <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> and header('Content-Type:text/html; charset=UTF-8'); but they dont do anything, any idea of why this is happening? i have tried using str_replace() to change £ to £ while in the database and reversing to display but it doesnt seem to want to work Thanks, +1 for any help
July 9, 201214 yr Author Helps if the database is also in UTF-8. database collation is in utf8_general_ci, tried in utf8_unicode aswel the collation of the field holding the data is also set as utf8_general_ci (as default) Try using ISO-8859-1 for the format instead, that may fix it Already tried
July 9, 201214 yr Out of interest, why would you reverse the str_replace for display? It should be displayed with £ to validate.
July 10, 201214 yr Author Out of interest, why would you reverse the str_replace for display? It should be displayed with £ to validate. Not for display, to put in the database, so when £ is submitted it will send £ to be stored in the database rather than £, it was only something i tried..
July 10, 201214 yr Like Shaun, I wondered why you were converting it twice as I also thought that saving it as £ and then extracting it as £ to a web page where the browser would convert it to £ would be OK, but if you've tried that, then try 163; (no space between and 163; ) instead of £ but I don't think that will make any difference. Edited July 10, 201214 yr by Wickham
July 10, 201214 yr Author Like Shaun, I wondered why you were converting it twice as I also thought that saving it as £ and then extracting it as £ to a web page where the browser would convert it to £ would be OK, but if you've tried that, then try 163; (no space between and 163; ) instead of £ but I don't think that will make any difference. It works no problem if i send to database as £ and display as £ on website therefore displaying the actual £ sign but its trying to get the text field to display as £ which is does put it puts the funny A before it Ive tried that too haha
July 10, 201214 yr I thought it might be something like the byte order mark, but it isn't, see http://en.wikipedia.org/wiki/Byte_order_mark So then I googled £ and found this topic http://www.webdeveloper.com/forum/showthread.php?t=191605 which suggests using & ;#163; no space between & and ;#163; (or possibly & ;pound; no space) I think this topic just repeats what you've found;- http://www.daniweb.com/web-development/php/threads/257604/fwrite-.txt-file-pound-sign-encoding-error- Edited July 10, 201214 yr by Wickham
July 14, 201214 yr Author This didnt work either (n) Its only when the £ is displayed in a text field it will put the A before it, if i submit £ then i just upload the page (where it uploads the inputted data) it will show the £ as usual its just the text field where the problem is I looked on PHP info without even thinking before and looked at the default charset and it is default_charset no value no value Does this NEED changing? lower down on php info under http headers info it tells me Content-Type text/html; charset=UTF-8 Thanks, Gary
Create an account or sign in to comment