cultureinfo

Swedish characters (åäö) not working on webserver but works on local computer

杀马特。学长 韩版系。学妹 提交于 2019-12-25 09:48:16
问题 As the headline says I have some strange problem of getting the special characters to work on the webserver but they show properly when I run the homepage from my local computer. Using visual studio express 2012 for web. .NET framework is verison 4.5.51209. In the aspx.vb file I change the Culture using. System.Threading.Thread.CurrentThread.CurrentCulture = New CultureInfo("sv-SE") And in the aspx file I have this code telling it should use UTF-8. Page Language="VB" Culture="sv-SE"

Get current country and location details using c#

北慕城南 提交于 2019-12-25 07:49:56
问题 I want to know where my application is used. Here is the code for getting the country name and Time zone : TimeZone localZone = TimeZone.CurrentTimeZone; var result = localZone.StandardName; var s = result.Split(' '); Console.WriteLine(s[0]); Console.WriteLine(RegionInfo.CurrentRegion.DisplayName); But my issue is, any one can change the time zone. Based on the time zone I may get wrong name. And the region settings is used as united states which cannot be changed. Because all the users has

Localize Windows Service

无人久伴 提交于 2019-12-25 03:28:16
问题 I want to Set Culture for Windows Service that I developed. Can someone recommend me a good read for or how to go about it. So far I have I Tried to do the Following OnStart() Dim oCultureInfo as CultureInfo = New CultureInfo("tr-TR") System.Threading.Thread.CurrentThread.Culture = oCultureInfo System.Threading.Thread.CurrentThread.UICulture = oCultureInfo After doing so I still see that My culture is US English. 回答1: Go to your setup which will be in the same solution. Right click on it and

Datetime value with different culture not formatting correctly

…衆ロ難τιáo~ 提交于 2019-12-24 08:49:57
问题 I'm having a slight issue with Thread culture and getting a date to display properly. I am overloading the ToString() method of the DateTime class. With culture "en-CA", my date is coming out in the right format "yyyy/MM/dd" but with culture "fr-CA", my date is coming out "yyyy-MM-dd" I've made some unit test to display the issue. The english test works but the french always fails. Even if I change the GetDateInStringMethod to do .ToShortDateString. I still get the same issue. [Test()] public

multi threaded wpf application setting thread cultureinfo

给你一囗甜甜゛ 提交于 2019-12-24 06:16:40
问题 I'm working on a multithreaded wpf application. To perform globalization i tried to set the current thread's(main thread) culture to invariant culturee in app.xaml.cs, So that all C# objects in app domain works on culture invariant info. But the problem arises when many threads comes to usage the worker threads invoked, those thread's culture are defaulted to OS Culture settings which i don't want. Help me in finding out a way where the worker threads created inherits the CultureInfo from

C# CultureInfo.CurrentCulture says en_US but my Windows settings are set to South Africa

▼魔方 西西 提交于 2019-12-24 00:48:29
问题 I changed my Region/Location in my Windows 8.1 control panel to be South Africa. When I start up my app from Visual Studio 2013 and get the CultureInfo.CurrentUICulture it still says "en-US". public CultureInfo getCurrentCulture() { if (CultureInfo.DefaultThreadCurrentUICulture != null) { return CultureInfo.DefaulThreadCurrentUICulture; } else { return CultureInfo.CurrentUICulture; } } I've also tried CultureInfo.CurrentCulture instead of CurrentUICulture, but they are behaving the same way.

Force date to US format regardless of locale settings

若如初见. 提交于 2019-12-24 00:48:24
问题 I have a VB6 program with this line: strDate = Format(Date, "ddmmmyyyy") I need it to always come out in this format according to the Cultural settings for Windows for English (United States): 17Jul2012 Unfortunately when the culture is set to something else, French, for example, I get this: 17juil2012 Is there any way to make the date format always use the English US formatting? 回答1: Rather than mess about trying to enforce a culture-specific format, why not just hard code the month names

Parse Boolean C# Culture verdadero

冷暖自知 提交于 2019-12-23 12:23:12
问题 I am trying to run this exact line, and it isn't working. Anyone know the reason why? Convert.ToBoolean("verdadero", new System.Globalization.CultureInfo("ES-MX")); I am parsing this from an xml file generated by a program that has many languages installed, and so it will use "true" in "EN-US" culture or "verdadero" in "ES-MX". 回答1: Interesting. Running Convert.ToBoolean through a decompiler emits this: /// <summary> /// Converts the specified string representation of a logical value to its

Thread.CurrentThread.CurrentCulture not working in a thread inside a threadpool

拈花ヽ惹草 提交于 2019-12-23 09:16:42
问题 I have a method which will be called inside a thread and those threads are managed by threadpool. The method is calling a DLL's method which unfortunately requires a specific locale for being performed correctly. Before puting this method to be ran by threadpool, I've tested it while running in application's main thread and also while I manually manage the threads and it works fine, but when I put it into work inside a threadpool, locale is not applied and consequently the method does not

Convert number into culture specific

主宰稳场 提交于 2019-12-22 14:18:09
问题 I have a number like 202667.4 . I want to convert this to number based on culture . For Ex: In "de"(German) the number should be in 202.667,40 . Any help will be greatly appreciated. Thanks. 回答1: If you want to represent existing number (say, double ) in culture specific format, try formatting : https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings double source = 202667.4; // "n" - ... group separators, and a decimal separator with optional negative sign