Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Internationalization / August 2005

Tip: Looking for answers? Try searching our database.

Override number formatting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris Mahoney - 05 Aug 2005 03:02 GMT
Hi

I've created my webapp on my local computer, and it all works fine. The
numbers are formatted as appropriate for my country (eg. 10 000 for ten
thousand). But when I upload to my server in the US, the format changes to
the American system (10,000 for ten thousand).

I've heard that you can get around this by adding the "culture" tag to
Web.config. However, Microsoft's default settings for my country are wrong.
If I add culture="en-NZ" to the Web.config, my local computer now uses the
wrong settings too.

How can I override the settings so that the numbers appear correctly?

Thanks
Chris
Beth N - 05 Aug 2005 16:07 GMT
Where is the standard of using a space as the group separator for en-NZ
defined? I have not been able to find such
a standard anywhere. The Common Locale Data Repository uniformly
displays a comma as the group separator
for that locale:
http://www.unicode.org/cldr/data/diff/main/en_NZ.html

Beth

> Hi
>
[quoted text clipped - 12 lines]
> Thanks
> Chris
Chris Mahoney - 06 Aug 2005 01:09 GMT
"New Zealand has adopted the SI or metric units of measurement" (from
http://www.med.govt.nz/buslt/compliance/standards/guide-2001/guide-2001-04.h
tml)

There is plenty of SI information available via Google, such as "The digits
of numerical values having more than four digits on either side of the
decimal marker are separated into groups of three using a thin, fixed space
counting from both the left and right of the decimal marker. Commas are not
used to separate digits into groups of three." (from
http://physics.nist.gov/cuu/Units/checklist.html, #16)

Anyway, this doesn't answer my question!

Chris

On 6/8/05 3:07 AM, in article OasWv9cmFHA.1464@TK2MSFTNGP14.phx.gbl, "Beth
N" <eflarup@yahoo.com> wrote:

> Where is the standard of using a space as the group separator for en-NZ
> defined? I have not been able to find such
[quoted text clipped - 21 lines]
>> Thanks
>> Chris
Mihai N. - 06 Aug 2005 09:18 GMT
> There is plenty of SI information available via Google, such as "The digits
> of numerical values having more than four digits on either side of the
> decimal marker are separated into groups of three using a thin, fixed space
> counting from both the left and right of the decimal marker. Commas are not
> used to separate digits into groups of three." (from
> http://physics.nist.gov/cuu/Units/checklist.html, #16)
SI has nothing to do with the number formatting.
All Europe uses SI for a long time, but the France uses non-breaking-space
(or non-breaking-half-of-space if you are to be more catholic than the pope),
Germany uses dots and so on.

And your quote is from NIST, which is an U.S. thing.

So, the question is again: what should it be for NZ ?

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email

Chris Mahoney - 09 Aug 2005 00:52 GMT
I came on here and asked how to override the number formatting. Could
someone please answer my question, rather than argue about what's right and
what's wrong.

Thank you.
Michael (michka) Kaplan [MS] - 10 Aug 2005 00:48 GMT
Context, please?

It is impossible to determine from the below what you are trying to do,
exactly.

But if it turns out that what you want to do is not a best practice and it
will not be good for the user of whatever you are developing, you should be
thanking the people who point it out....

Signature

MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.

>I came on here and asked how to override the number formatting. Could
> someone please answer my question, rather than argue about what's right
> and
> what's wrong.
>
> Thank you.
Chris Mahoney - 17 Aug 2005 23:52 GMT
Sorry about the delay in replying.

> Context, please?
>
> It is impossible to determine from the below what you are trying to do,
> exactly.

Sorry, I have a bad habit of not including all the information :)

Simple line of VB code:
TextBox1.Text = String.Format("{0:c0}", 12345)

This results in the TextBox filling with "$12,345" when I want it to say
"$12 345".

> But if it turns out that what you want to do is not a best practice and it
> will not be good for the user of whatever you are developing, you should be
> thanking the people who point it out....

Look at any NZ Government publication (or many other NZ publications) and
you'll find a space as the separator.

Thanks
Chris
Michael (michka) Kaplan [MS] - 18 Aug 2005 15:46 GMT
You can update the numeric grouping separator in a CultureInfo's
NumberFormatInfo and then use that ci or nfi to do the formatting -- that is
the best way to proceed hee, given the code you are using (note the
String.Format override that uses an IFormatProvider -- you can pass the NFI
right there).

Signature

MichKa [Microsoft]
NLS Collation/Locale/Keyboard Technical Lead
Globalization Infrastructure, Fonts, and Tools
Blog: http://blogs.msdn.com/michkap

This posting is provided "AS IS" with
no warranties, and confers no rights.

> Sorry about the delay in replying.
>
[quoted text clipped - 22 lines]
> Thanks
> Chris
Chris Mahoney - 19 Aug 2005 00:25 GMT
Aha!

After all that trouble, I knew it'd be quite simple to do. Thanks!

Chris

On 19/8/05 2:46 AM, in article umZMoOApFHA.3544@TK2MSFTNGP15.phx.gbl,

> You can update the numeric grouping separator in a CultureInfo's
> NumberFormatInfo and then use that ci or nfi to do the formatting -- that is
> the best way to proceed hee, given the code you are using (note the
> String.Format override that uses an IFormatProvider -- you can pass the NFI
> right there).
Mihai N. - 10 Aug 2005 07:43 GMT
> I came on here and asked how to override the number formatting. Could
> someone please answer my question, rather than argue about what's right and
> what's wrong.
In general I don't like teaching people how to shoot themselves (in the leg
or otherwise :-)

Signature

Mihai Nita [Microsoft MVP, Windows - SDK]
------------------------------------------
Replace _year_ with _ to get the real email


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.