currency doesnt appear on my page

  • buzzby365
  • Proficient
  • Proficient
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 288
  • Status: Offline

Post May 19th, 2004, 5:28 am

how can i make the £ (pound sign) appear on my pages, a funny symbol appears on the site but in my text file for the database it has the £ pound sign.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post May 19th, 2004, 5:28 am

  • s15199d
  • Expert
  • Expert
  • User avatar
  • Joined: Feb 20, 2004
  • Posts: 524
  • Loc: NC, USA
  • Status: Offline

Post May 19th, 2004, 6:47 am

Code: [ Select ]
£


Try google next time.
Image
Give a man a fish he eats for a day. Teach a man to fish he eats for a lifetime.
  • s15199d
  • Expert
  • Expert
  • User avatar
  • Joined: Feb 20, 2004
  • Posts: 524
  • Loc: NC, USA
  • Status: Offline

Post May 19th, 2004, 6:48 am

Code: [ Select ]
& pound;


no space between the & and pound
Image
Give a man a fish he eats for a day. Teach a man to fish he eats for a lifetime.
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post May 19th, 2004, 6:54 am

s15199d, how does that help - He appears to be having a problem converting the £ sign in the text file to the correct symbol on the html page.

one solution is to convert all of the £'s to

Code: [ Select ]
&# 163;

inside the database, which will show up as £ on the html page, if you have no space as above

This should work, unless the problem is the font you are using, although I cannot see why any standard font would not have the pound available....

Hope this helps

//edit sorry s15199d - I saw the first post and I thought you were just being an ass lol - I just did the exact same thing with my version :lol:
CSS website design tutorials
  • buzzby365
  • Proficient
  • Proficient
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 288
  • Status: Offline

Post May 19th, 2004, 7:18 am

Code: [ Select ]
create table kitpack (
id int not null auto_increment,
title VARCHAR(40),
packinfo TEXT,
packprice VARCHAR(7),
PRIMARY KEY (id)
)
  1. create table kitpack (
  2. id int not null auto_increment,
  3. title VARCHAR(40),
  4. packinfo TEXT,
  5. packprice VARCHAR(7),
  6. PRIMARY KEY (id)
  7. )


this is one record as it stands:

Code: [ Select ]
INSERT INTO kitpack VALUES (1, "Starter Pack", "Visit to you property, discussion of the project outline and a letter issued to the Local Authority to establish whether permission is required. (Package includes kits A1 + A2)", "£175");


are you now saying that i should write it like this?

Code: [ Select ]
INSERT INTO kitpack VALUES (1, "Starter Pack", "Visit to you property, discussion of the project outline and a letter issued to the Local Authority to establish whether permission is required. (Package includes kits A1 + A2)", "£175");
  • buzzby365
  • Proficient
  • Proficient
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 288
  • Status: Offline

Post May 19th, 2004, 7:19 am

the bottom one has the & pound ; 175......(no spaces... i see that it is right
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Mar 24, 2004
  • Posts: 1855
  • Loc: Uk
  • Status: Offline

Post May 19th, 2004, 7:22 am

yup you made the same mistake as both of us. If you store that in the database then that sould get transfered identically to the html as &# pound; which should prevent any kind of conversion error or whatever the hell is going on.
CSS website design tutorials
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 28, 2004
  • Posts: 1099
  • Status: Offline

Post May 19th, 2004, 7:41 am

Is the pound symbol showing up in the database itself? If so, you might not want to store an equivalency instead of the real symbol (for portability). Up to you, but probably reason that symbol is showing up funny is the charset encoding for your browers (or whatever client you're displaying the data on, I'm assuming a web browser).

I would first try a script conversion, instead. Translate the character to a readable format after you pull it from the database, not as you insert it.

Any language you might be using has a way to do this, whether you use a RegEx or a VB replace command... just translate £ to £ (or £ either one) before displaying the symbol.

.c
  • buzzby365
  • Proficient
  • Proficient
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 288
  • Status: Offline

Post May 19th, 2004, 8:23 am

not sure what i am doing wrong. i have ionput the code but now its just coming up with a single figure. i want £999 its coming up with £9.

not sure what to do about it. tried both ways. they both bring up the "£" symbol but with only 1 figure after
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 28, 2004
  • Posts: 1099
  • Status: Offline

Post May 19th, 2004, 9:17 am

buzzby365 wrote:
not sure what i am doing wrong. i have ionput the code but now its just coming up with a single figure. i want £999 its coming up with £9.

not sure what to do about it. tried both ways. they both bring up the "£" symbol but with only 1 figure after


Your VARCHAR is only length 7, and you're putting in
1 &
2 #
3 1
4 6
5 3
6 ;
7 9
8 9
9 9

Nine Characters. Everything after character 7 is being cut off. Change your VARCHAR length for that field to something higher that will fit any length you might need (say, 20)

.c
  • buzzby365
  • Proficient
  • Proficient
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 288
  • Status: Offline

Post May 19th, 2004, 9:40 am

thank you so much. worked like a charm
  • Carnix
  • Guru
  • Guru
  • User avatar
  • Joined: Apr 28, 2004
  • Posts: 1099
  • Status: Offline

Post May 19th, 2004, 11:05 am

Excellent!

You know... not to throw you even further off.. but you might consider not using a VARCHAR at all for that. Don't bother storing the currency symbol at all, and store the value as an INT datatype. Then, you would be able to easily convert it to USD or any other currency should that be needed in the future. Just apply the symbol in the output stream (HTML) wherever you are placing the currency value.

Not doing this means that to do any sort of math on the value, you would have to strip the symbol, then coerce the value to a numberic (which is easy, but sort of ugly).

Code: [ Select ]
$str = "1";
$num_from_str = $str*1;
  1. $str = "1";
  2. $num_from_str = $str*1;


This converts the string "1" to the numerical value 1. Not doing this could result in errors in some cases.

Anyway, just another option to consider,
Good luck!
-mike

* EDIT:
The simplistic way I show to convert a string number to a numeric number is only valid when the string is actually a number! It's an example of implict type coersion. If your string somehow happened to be "123four" or "hello world" and you tried this, you'd get a type error just as you would if you tried "2" * 5. Also note that some parsers can do implicit coersion automatically (meaning "2" * 5 would NOT return an error, and actually equal 10), but most of the time it seems they are really good at going from anything to string types, but really stubborn about going the other way...
  • buzzby365
  • Proficient
  • Proficient
  • No Avatar
  • Joined: May 14, 2004
  • Posts: 288
  • Status: Offline

Post May 19th, 2004, 12:07 pm

right now you are blowing my mind away. you th red baron or something? LOL. thanks anyway. something to consider 4sho.

Post Information

  • Total Posts in this topic: 13 posts
  • Users browsing this forum: No registered users and 137 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.