I have a asp.net mvc application which stores currency types in the database. Symbol for each currency is also stored in the db. Currency types are retrieved from the db and currency symbols are displayed in a dropdown in my application.
In my development machine all of the currency symbols are displayed properly in the dropdown. But in the production machine, turkish currency symbol is displayed as a square for the same dropdown. Both environments have the same symbol in the db. And this symbol is retrived from database and presented without any modifications all the way to the browser.
My development machine is set to United States format, production machine is set to Swedish format. So I initially thought the problem was because of that, but when I change the system format to swedish in my dev machine, I couldn't reproduce the problem.
Another difference between the environments is the .net version, they are slightly different, but it is less likely to be the root cause of the issue.
I am running out of ideas, can somebody guide me the right direction?
Related
I have a requirement where I have a site and the user enters the product information from an administrative end.
One of the mandatory requests is to select a country for the product before the user can save the product.
When a public user arrives at the site they need to have the option to swap between the languages. So if I arrived to the German site and want to view the site in English I should be able to change from German to English (and back to German).
I have the resource files created (German) however how do I swap between the two languages. I appreciate I may need to tweak a little more but if I can get onto the right track I can take it/question from there?
First you ensure you save the data in the correct encoding in your database by configuring the data collation for each language, and save it in the correct datatype.
To do that you must do the following :
Database
Ensure the column or database collation is defined to the targeted language read more about it SQL Server, Oracle, MySQL
Ensure the column datatype is designed to accept Unicode characters. (if you save some text, it should show it as is).
Application
in your ASP.NET Application, you ensure that you read these data from the database with the correct encoding ( UTF-8 is a common encoding for the web, but sometimes you might need to use ASCII or Unicode then convert it back to UTF-8 depends on the language you're dealing with).
After ensuring the string encoding. You can now use it on your ASP pages, you only need to control the page language you have two options.
Option 1 : Use Javascript to translate the page to another language dynamically using html lang attribute.
Option 2 : Use .NET Globalization by defining the translations using resources files more in that in this link
The data type in database is "decimal", the value is normally like 2.6, 3.8 etc
But when I render it on the front side, it become 2,6
I wondering why it happens and how to handle it correctly.
I try to adjust .Net Globalization Culture in IIS become EN, then display as I want.
Not the setting is Invariant Language.
I had print out culture info by C#, it shows GB
How can I handling it as all display number with dot
We have an web application in C# in where we have multiple pages with reportviewer controls, and almost all of them have date parameters.
That date parameters are rendering a datepicker (everything it's fine till this point, no exceptions, no problems) but all the datepickers starts on Sunday ("domingo" in spanish, "do" abbreviated) and our client complains about it; he wants it to start on monday ("lunes" in spanish, "lu" abbreviated).
Accessing the same reports from reportserver works fine, all the datepickers starts on monday("lu") and it works fine:
I've checked that user's Culture and CultureUI it's correct (es-ES for spanish culture); and i think that's working fine cause today's text and day names are properly translated...
I've Googled it and i have only found that if you change DATEFIRST in SQL it must be solved; but it doesn't.
Can anyone give me a clue or any solution?
I know that i can use my own parameter selectors and call the reportViewer only to load the report with the parameters, but this solution will take a long time and we prefer to avoid that solution.
I've also read that with Reflection i can access the Datepicker class inside Microsoft.Reporting and change it to start on monday; but it's not a "nice" solution and it's really complex.
I've had similar trouble with date-format on the client. The doco says that it should determined by the Language of the report, so set that to the language of the client (see below). You could even be more specific and set the language to es-ES
But I've found this approach does not always work. (for me at least). Once the report is set up like this, changing the client locale, should change the date format (and start day of week).
At one point changing the locale of the SSRS server had the desired effect (but this is a pretty sweeping change)
I have a software developed in C#, which is a pure sentefic application. Howver the German users found this software stopped working from time to time, when it is installed on German computers. The temporary solution is to change the Language setting in the control panel, and it works fine after we change the language setting from German to English. This is just a kind of engineering sofware, and the software have nothing relalted to the German or English language. Also, as suggested from other posts in msdn, I have checked the "InitializeComponent()" in the source does several times. There are not strange codes in the "InitializeComponent()" function.
When you change locale, you change the meaning of ',' (comma) and '.' (full-stop) when used in numbers. Could it be that you are trying to parse text containing these characters into numbers?
Does your program attempt to initialize numeric fields with formatted numbers, perhaps?
You need to make sure that your code is sensitive to the user's culture when parsing and formatting text. You also need to make sure you use a consistent culture (e.g. the InvariantCulture) when reading data stored to file or sent over a network.
If you are using .NET Framework 4.5, you might be interested to read about the CultureInfo.DefaultThreadCurrentCulture Property.
In the .NET Framework 4 and previous versions, by default, the culture
of all threads is set to the Windows system culture. For applications
whose current culture differs from the default system culture, this
behavior is often undesirable.
The examples and their explanations on the page could be quite helpful for your issue.
Also, as a side note, try{...}catch{...} blocks are always welcome.
I have a report choosing start date and end date.
I tested at the office and it is working fine.
When it is installed at the user's place, the following error pops up.
I wonder why is that?
I bring back the database and run at the office.
Still working fine.
Well, it's not a parsing problem in DateTime.Parse, which is what I first expected. Your code (Form1.Calculat) is calling the constructor directly, so you should be able to log what values you're trying to use to create the DateTime, along with which row of the database is causing the problem.
We can't really do any of that diagnostic work for you, but once you've worked out what the values are, you should look through your code to work out where they're coming from.
Does your client have a different default culture to your development machine? That's normally the first port of call - but unless you're manually parsing date/time strings into their constituent bits, I wouldn't have particularly expected this failure mode.
If you could post some code, that would really help.
Are you passing the values to the TimeToTicks method ?
Probably these values are not forming a valid DateTime. Why it works on your office PC might be because you have different culture settings.
For example, in one culture "11/25/2010" is a valid date as the format (MM/dd/yyyy), but on a different culture, where date format is set as (dd/MM/yyyy) it will not be a valid date.
You can change the system date format from the control panel or modify your code accordingly. Hope this helps.
I think it is most of a problem Culture specific rather than any other issue. At one system the date format would be MM/DD/YYYY and at other system it would DD/MM/YYYY or something like that. So the datetime object should be picked culture specific and values should be passed that way as well.
Hope it fixes the problem.