469,327 Members | 1,242 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,327 developers. It's quick & easy.

Session.LCID & FormatNumber


I'm doing some tests to see if the Session.LCID can be used to easily change
a user-dependant locale for number & date/time formatting in ASP. As far as
I get the theory this should work, but I'm concerded that there might be
some issues when serverside regional settings are changed.

I'm having this one case where I'm having something odd already.
This is my testcode:

<%
session.lcid = 2067 ' nl-be

Dim Num
Num = 0.5

response.write formatnumber(Num, 2) & "<br>"
response.write formatcurrency(Num) & "<br>"
response.write Num & "<br>"
%>

The result I get is:

0.50
? 0.50
0,5

Question:
Why is a dot used as the decimal seperator in the first 2 cases, while a
comma is used in the last?
Even if changes have been made to regional settings (setting default use of
comma in Belgium to a dot), shouldn't those be used in ALL cases?


Jul 19 '05 #1
6 8240
"J. Baute" <WU**********@spammotel.com> wrote in message
news:40*********************@news.skynet.be...

I'm doing some tests to see if the Session.LCID can be used to easily change a user-dependant locale for number & date/time formatting in ASP. As far as I get the theory this should work, but I'm concerded that there might be
some issues when serverside regional settings are changed.

I'm having this one case where I'm having something odd already.
This is my testcode:

bonjour J. Baute

Try
SetLocale "nl-be"
and also be sure that the character set is send to the client. This is
normally ISO...
Response.CharSet = "windows-1252"

The windows characterset has the euro symbol...
<%
session.lcid = 2067 ' nl-be

Dim Num
Num = 0.5

response.write formatnumber(Num, 2) & "<br>"
response.write formatcurrency(Num) & "<br>"
response.write Num & "<br>"
%>

The result I get is:

0.50
? 0.50
0,5

Question:
Why is a dot used as the decimal seperator in the first 2 cases, while a
comma is used in the last?
Even if changes have been made to regional settings (setting default use of comma in Belgium to a dot), shouldn't those be used in ALL cases?


Jul 19 '05 #2

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
"J. Baute" <WU**********@spammotel.com> wrote in message
news:40*********************@news.skynet.be...

I'm doing some tests to see if the Session.LCID can be used to easily change
a user-dependant locale for number & date/time formatting in ASP. As

far as
I get the theory this should work, but I'm concerded that there might be
some issues when serverside regional settings are changed.

I'm having this one case where I'm having something odd already.
This is my testcode:

bonjour J. Baute

Try
SetLocale "nl-be"
and also be sure that the character set is send to the client. This is
normally ISO...
Response.CharSet = "windows-1252"

The windows characterset has the euro symbol...


hmmm, I didn't notice that euro symbol got lost in the usenet post, it did
show up as expected on my system though, so no issues there :)

it turns out that the HKUsers\.default\Control Panel\International settings
had been changed manually in the past,
and since the system is initially installed with nl-be regional settings,
this seems to be causing the abnormal decimal point behaviour when using
that specific locale,
makes sense I guess

thanx anyway
J.
Jul 19 '05 #3
"J. Baute" <WU**********@spammotel.com> wrote in message
news:40**********************@news.skynet.be...

"Egbert Nierop (MVP for IIS)" <eg***********@nospam.com> wrote in message
news:OY**************@TK2MSFTNGP09.phx.gbl...
"J. Baute" <WU**********@spammotel.com> wrote in message
news:40*********************@news.skynet.be...

I'm doing some tests to see if the Session.LCID can be used to easily change
a user-dependant locale for number & date/time formatting in ASP. As

far
as
I get the theory this should work, but I'm concerded that there might be some issues when serverside regional settings are changed.

I'm having this one case where I'm having something odd already.
This is my testcode:

bonjour J. Baute

Try
SetLocale "nl-be"
and also be sure that the character set is send to the client. This is
normally ISO...
Response.CharSet = "windows-1252"

The windows characterset has the euro symbol...


hmmm, I didn't notice that euro symbol got lost in the usenet post, it did
show up as expected on my system though, so no issues there :)

it turns out that the HKUsers\.default\Control Panel\International

settings had been changed manually in the past,
and since the system is initially installed with nl-be regional settings,
this seems to be causing the abnormal decimal point behaviour when using
that specific locale,
makes sense I guess
Still, it's abug. I believe not all vbscript engines have that behaviour.
Vbscript should behave like Session.LCID is configured.
thanx anyway
J.


Jul 19 '05 #4
Still, it's abug. I believe not all vbscript engines have that behaviour.
Vbscript should behave like Session.LCID is configured.


I've been doing some more testing, by looping through all possible LCID
values with SetLocale, and comparing the result from a CStr() &
FormatNumber(), which should always be equal, and list those cases where
this is not the case.

Currently on one system (the one where the settings have been manually
changed in the registry) I'm getting differences on locales 1033 (en-us) and
1024.
I can't find what locale 1024 is in the LCID list on MSDN though, does
anyone know what this value is used for?

thx,
J.
Jul 19 '05 #5
Please, how to formating number in indian format as 23,32,444 in asp&vbscript
May 5 '06 #6
formating number in formatnumber function do'nt solve problem
May 5 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Claudio Cezar | last post: by
5 posts views Thread by b_boy | last post: by
2 posts views Thread by grw | last post: by
1 post views Thread by Hagge | last post: by
reply views Thread by ubi_comp | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.