Solved

FormatCurrency Issue

Posted on 2008-06-24
9
782 Views
Last Modified: 2012-08-13
Hi all

When I use FormatCurrency(1.00) in ASP I get £1.00.  Anybody got any clues?
<% @ LANGUAGE="VBScript" %>
<% 
Dim strCurrencyTest
	
	Session.LCID = 2057
	strCurrencyTest = FormatCurrency(1.00)
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head> 
	<title>Currency Test</title>
</head> 
<body>
	<form>
	<table>
		<tr>
			<td><%=strCurrencyTest%></td>
		</tr>
	</table>
	</form>
</body>
</html

Open in new window

0
Comment
Question by:OxonDev
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 22

Expert Comment

by:neeraj523
ID: 21863165
can you check the output using

Session.LCID = 1033


0
 
LVL 2

Expert Comment

by:Deepika_Rastogi
ID: 21863239
You can use the VBScript SetLocale function in conjunction with FormatCurrency to change the currency symbol displayed.

SetLocale(LCID)

You can use the Decimal, Hex, or Short String value for the LCID (Locale ID), for example these will all set the Locale to English - United States:

SetLocale("en-us")   :    SetLocale(0x0409 )    :    SetLocale(2057)

Also visit
http://msdn.microsoft.com/en-us/library/5xf99h19(VS.85).aspx
for further assistance
http://msdn.microsoft.com/en-us/library/0h88fahh(VS.85).aspx
to view the locale id chart


0
 
LVL 2

Expert Comment

by:Deepika_Rastogi
ID: 21863270
Also

If you can run a global.asa file on your server then place the following into your global.asa file to change the locale settings throughout your site: -
   
 'When a session starts on the server the following code will be run
Sub Session_OnStart

     'Set the server locale
     Session.LCID = 1033
End Sub  
   

If you can not use a global.asa file, place following into the top of each ASP page you wish to change the locale settings on: -

   
 <%
'Set the server locale
Session.LCID = 1033%>
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 10

Expert Comment

by:bluefezteam
ID: 21863855
That is invalid html markup for £, what you need is &pound;
0
 
LVL 10

Accepted Solution

by:
bluefezteam earned 250 total points
ID: 21863858
just use this

<%
response.write("&pound;" & formatNumber("2",2))
%>
0
 
LVL 5

Expert Comment

by:Abiel de Groot
ID: 21866726
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>

Sets the character encoding UFT8

Regards

A.
0
 
LVL 5

Expert Comment

by:Abiel de Groot
ID: 21866742
Also...

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

A.
0
 
LVL 6

Author Comment

by:OxonDev
ID: 21869922
Thanks all for your efforts but bluefezteam was the only one to find a work around for the problem so...  It would still be nice to know what causes it in the first place but I settle for a fix!
0
 
LVL 10

Expert Comment

by:bluefezteam
ID: 21874101
glad to be of help

cheers
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…

828 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