Solved

Problem with localization for international users

Posted on 2011-03-21
9
305 Views
Last Modified: 2012-06-21
I have a payment processing screen which work great for US based users. But for some users outside of US in Chile and Brazil, the amount of $95.00 comes in as $95,00 (with a coma) and that is processed as $9500.00 by Authorize.net.

Code is like this -
               string CCAmount = payment.Amount.ToString("#######.00");

How do I fix this localization issue.

Side note - Even the date came in as - '18-03-2011 16:23:24' but date is not a problem as I can handle that. I am not sure how to handle the amount part.
0
Comment
Question by:nsdlsandy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 35181264
Sounds like you need to enforce a specific culture for your page:

   http://msdn.microsoft.com/en-us/library/bz9tc508(v=VS.80).aspx
0
 
LVL 1

Author Comment

by:nsdlsandy
ID: 35182052
I have this in the web.config

    <globalization requestEncoding="utf-8" responseEncoding="utf-8" enableClientBasedCulture="true" culture="auto" uiCulture="auto" />

According to the article above, this should take care of specific culture. Please let me know what else I should try.
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 200 total points
ID: 35182388
Auto lets the browser use it's current system settings to decide. Whereas it seems like you want to force it into US format, in which case you would set it to en-US rather than auto
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 23

Accepted Solution

by:
wdosanjos earned 300 total points
ID: 35182548
Try this:

System.Globalization.CultureInfo usCulture = new System.Globalization.CultureInfo("en-US");
string CCAmount = payment.Amount.ToString("#######.00", usCulture);

Open in new window


I hope this helps.
0
 
LVL 1

Author Comment

by:nsdlsandy
ID: 35194234
carl_tawn,

I changed web.config entry -
    <globalization requestEncoding="utf-8" responseEncoding="utf-8" enableClientBasedCulture="false" culture="en-US" uiCulture="en-US" />

Still it is showing the comma in the currecy. Please see the attached screen shot. I am able to replicate this issue by changing the Language to Spanish(Chile) in the browser. Please let me know what else I can try.

thanks
SM
 Comma-in-Currency

Without Comma , the currency with English(United States) comes right as shown below

 Without-Comma-in-Currency
0
 
LVL 1

Author Comment

by:nsdlsandy
ID: 35194313
wdosanjos

Thanks for your suggestion. I will try to do the code change and test it out.

regards
SM
0
 
LVL 27

Expert Comment

by:Chinmay Patel
ID: 35236411

wdosanjos has given the perfect solution, only change I would suggest is to not to declare an extra variable[and if you are doing such conversion a lot then create a global instance]

string CCAmount = payment.Amount.ToString("#######.00", new System.Globalization.CultureInfo("en-US")); 

Open in new window


Regards,
Chinmay.
0
 
LVL 1

Author Closing Comment

by:nsdlsandy
ID: 35288271
Helped in solving my issue
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

710 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