问题标签 [invariantculture]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
115843 浏览

c# - 如何为整个 c# 应用程序设置默认文化信息

我想为该类或整个应用程序设置默认文化信息。

例如在土耳其 3,2 = 英语 3.2

所以应用程序使用我的本地,但我希望它用作默认值

我如何将其设置为该特定类或整个应用程序的默认值

0 投票
2 回答
908 浏览

json - 将日期(dd/mm/yyyy)和浮点(逗号)值发布到 aspnet WebApi

问题

当我将 jSon 数据发布到 webapi 时,使用 pt-br 格式(日期为 dd/mm/yyyy,浮点数为逗号小数分隔符),这些值被反序列化为 en-us 格式,从而导致错误。

IE

» 日期:发布 23/01/2013 变为 01/01/0001

» 浮动:发布 1,4 变为 0.0

帮助请求

任何人都可以帮我定义“终极”解决方案,以使用除美国以外的其他文化将数据发布到 web api。我已经阅读了一些讨论,但没有一个提供完整的解决方案,甚至没有一个可行的解决方案。

考虑以下

模型:

ApiController 方法

AjaxCall

** 我已经在 web.config 中添加了以下全球化设置

0 投票
1 回答
97 浏览

c# - 非英文windows下转换十进制

我已经在西班牙 MS Windows Server 下安装了 C# 应用程序。

所以这段代码以错误的方式工作。

convertTop 是 80000 但它应该是 80.0

0 投票
2 回答
349 浏览

c# - 如何将字符串放入文化不变的桶中?

我的应用程序需要处理可以包含重音字符的字符串。我需要能够将这些名称分组到不同字母的存储桶中。

本来想在.Net中使用CultureInvariant字符串比较,但是这样做有两个问题:

  1. 它实际上不会说字母 C 与 C cedilla 相同,但我需要这种相等性。

  2. WinRT 的 .Net 版本在任何地方都没有 CultureInvariant 作为选项。

任何人都可以建议一种算法或至少一个起点,我可以用来尝试将不同的字母组合在一起吗?

谢谢。

0 投票
1 回答
589 浏览

c# - StringComparison.InvariantCulture Clarification?

According To MSDN : StringComparison.InvariantCulture :

Specifies the culture, case, and sort rules to be used by certain overloads of the String.Compare and String.Equals methods.

Well , I'm not doing any sort here in my sample , And still don't understand why does it yield the result it yield :

InvariantCulture uses comparison rules based on english, but without any regional variations

1) So why it says that lasst is equal to laßt ? (one doesnt even has an english char...)

2) And why ( if it's flatten to english)hello is not equal to héllo ?

0 投票
2 回答
2793 浏览

c++ - boost::lexical_cast<> 的语言环境不变保证

boost::lexical_cast<std::string>(double)用于将双精度转换为字符串,生成 JSON 序列化字节流,即(在远程端)由 .NET 解析。

我能够强制 .NETInvariantCulture用于解析,从而在每种可能的语言上返回可预测的结果。

但是,我无法在boost::lexical_cast文档中找到这个保证。我试了一下,对于不同的语言环境,它的工作方式相同。但是,我不能仅从少数测试中确定,我是否遗漏了文档中的某些内容,或者这根本无法保证,我必须使用其他东西?

编辑:我发现了一个问题。

返回0,15784465,这是不希望的。我可以强制boost::lexical_cast<>不知道语言环境吗?

0 投票
1 回答
1118 浏览

c# - property.GetValue 忽略 CultureInfo

似乎由于某种原因 property.GetValue 忽略了 CultureInfo。这是我试图实现的目标:

我只是使用它保存到磁盘

在生成的文件中,对于值为 50.33 的 double 类型的属性 Frequency 我得到了

这是 CurrentCulture (波兰语使用逗号作为分隔符),但不是

正如我所料。有什么想法可能是错的吗?

0 投票
1 回答
759 浏览

c# - C# LINQ string.startsWith 不忽略文化特定的字母

我有点喜欢泡菜。从我在 .Net 中阅读的有关 StringComparison 的所有文档中,当过滤器为“ ke ”时, InvariantCulture应该同时选择“ Kęstutis ”和“ Kestutis

但它仍然迫使我输入特定语言的字母。

我不确定它是否重要,但数据库是 Ms SQL 2012 Express。

有任何想法吗?

0 投票
1 回答
3999 浏览

c# - 如何在 ms 图表控件中格式化轴

我正在使用 ms 图表控件并希望执行以下操作:将 chartAreas[0] 的 Y 轴格式化为特定格式。在这种情况下,它应该是一个没有小数的数字,并用一个点分组(每千)。

尝试过:chart1.ChartAreas[0].AxisY.LabelStyle.Format = "{#.###}";

但这并没有给我正确的结果。所以我试图获取 FormNumber 事件并用这个进行测试:

使用:

没有成功,而通常如果你有这样的事情:

test 将返回 123.456,789(独立于用户计算机上的文化设置)。

但这似乎不适用于 ms 图表控件。

有人可以向我解释如何能够做到以下几点:

格式化chartArea[0] 中的Y 值,不带小数,并以点作为组分隔符。同时将x 值格式化为dd-MM 格式(如16-10 => 10 月16 日),而值为实际上是一个 Uint 20131016。格式必须与文化设置无关。希望有人可以帮助我。亲切的问候,

马蒂斯

0 投票
1 回答
2444 浏览

vbscript - How to Set CultureInfo to InvariantCulture Classic ASP (VBScript)

I am looking for a way to set a Classic ASP page's Culture Info to Invariant Culture so that the decimals have a dot and not a comma. This gives me allot of issues, On windows 8 doesn't work, get it to work on windows 8, then it doesn't work on previous versions of windows anymore.

In C# the whole thread's Culture can be set once and forget about it,

How can I achieve something like this with Classic ASP? I tried setting the LCID on top of each page as well as in the session

Session:

But this does not work

EDIT:

In <%@ LANGUAGE="VBScript" LCID=7177%> I Changed LCID=7177 to LCID="127"

I have set Session.LCID=127

In IIS under ASP tab, I set Locale ID to 127

and in the Web.Config, I set globalization

I am not sure, which of these made the difference, But It works now and the Decimal values have a dot in them and not a comma