Solved

Problem with localization for international users

Posted on 2011-03-21
9
306 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

627 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