Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Pound sign problems

Featured Replies

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

  • 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 :(

Out of interest, why would you reverse the str_replace for display? It should be displayed with £ to validate.

  • 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..

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 by Wickham

  • 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

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 &amp ;#163; no space between &amp and ;#163; (or possibly &amp ;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 by Wickham

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.