Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

posting £ symbol as £

Posted on 2011-03-15
14
Medium Priority
?
545 Views
Last Modified: 2012-05-11
How do I post a £ symbol into a mysql table field as the html equivalent?

i.e. £

as currently the value posted is £25K

Why does it add the "Â"?
0
Comment
Question by:petewinter
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 3
  • +1
14 Comments
 
LVL 14

Expert Comment

by:svgmuc
ID: 35137880
Enable latin1 and you should be able to use the UK pound sign.
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35137885
use £ for pound symbol

see this table
http://www.ascii.cl/htmlcodes.htm
0
 
LVL 82

Expert Comment

by:leakim971
ID: 35137923
Before posting, (use the onsubmit attribute of your form for example) you may use the function HTMLentities(texte) from here : http://www.editeurjavascript.com/forum/topic,2,39285,0.html
0
Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

 

Author Comment

by:petewinter
ID: 35138209
So when I post the value do I need to wrap this code with something?

$_POST["salary"]
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35138280
You don't have to decode it back it, if you use the html code £
 
0
 

Author Comment

by:petewinter
ID: 35138303
How can I do that?

In the form text field users will just enter "£"? How can I convert it to £ ?
0
 
LVL 40

Expert Comment

by:Gurvinder Pal Singh
ID: 35138317
0
 

Author Comment

by:petewinter
ID: 35138329
Does that make sense?

Users are entering the £ symbol in a text field and I need it to be entered into my mysql database as £
0
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 1000 total points
ID: 35138355
how does it matter what you enter in database at first place, since it will show £ symbol again when you will fetch it back from database?



0
 
LVL 82

Expert Comment

by:leakim971
ID: 35138450
>Users are entering the £ symbol in a text field and I need it to be entered into my mysql database as £

Use :

myform.onsubmit = function() {
      //var salary = document.getElementById("salary");
      var salary = document.getElementsByName("salary")[0];
      salary.value = encodeURIComponent(HTMLentities(salary.value));
}

Open in new window

0
 

Author Comment

by:petewinter
ID: 35138524
The problem is it gets entered as "£" for some reason instead of "£" Any idea's why it does this?
0
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 1000 total points
ID: 35138552
£ -> utf8

Use the same format everywhere : in your page, your database, server language
Should be UTF-8 to avoid this type of problem
0
 

Author Comment

by:petewinter
ID: 35138655
I just change the field collation to utf8_unicode_ci , but still the same problem?
0
 

Author Closing Comment

by:petewinter
ID: 35139290
Thanks you have made me realise where I am going wrong.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

660 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question