[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Saving Currency Symbols in MySQL

Posted on 2010-01-05
4
Medium Priority
?
2,815 Views
Last Modified: 2012-05-08
Hello,

I'm trying to save Currency symbols in PHP/MySQL but they aren't saving correctly in the DB.

The Euro is saved as: ï

And the British Pound as: â

I'm using varchar(1) with utf8_general_ci collation for the currency.  The $ sign saves fine.

Any ideas on how I can get it the euro and pound to save as '¬' and '£' ?

Thanks!
0
Comment
Question by:NeedExpertHelp
3 Comments
 
LVL 20

Accepted Solution

by:
DVation191 earned 672 total points
ID: 26183114
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 664 total points
ID: 26185417
You might also consider using an entity for the character.  You would not need to depend on making aprt of your DB UTF-8, (or messing around with PHP's spotty UTF-8 support) and most browsers should render the entity correctly.
http://www.w3.org/TR/html4/sgml/entities.html
0
 
LVL 6

Assisted Solution

by:Ludwig Diehl
Ludwig Diehl earned 664 total points
ID: 26204137
if it is a web project then you could always store the ascii code (DEC) thus for

pounds => 163
euros => 128

and if using PHP you can retrieve it using  chr(DEC) where DEC is the ascii code

for further information you can take a look at http://www.ascii-code.com/

If you want to store them( symbols ) directly to the database then you consider using latin1 as default charset

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

This article shows the steps required to install WordPress on Azure. Web Apps, Mobile Apps, API Apps, or Functions, in Azure all these run in an App Service plan. WordPress is no exception and requires an App Service Plan and Database to install
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month18 days, 8 hours left to enroll

826 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