想象一个抽象的问题。
有一个与服务器(S
)交互的客户端(C
)。它们更改日期变量(d
)。
服务器可以是法语或英语,客户端也可以。
法国客户端(“2011年12月31日”)发送到英文服务器(“2011月12日”)的日期无法识别。反之亦然。
如何避免.NET中出现这样的问题。
想象一个抽象的问题。
有一个与服务器(S
)交互的客户端(C
)。它们更改日期变量(d
)。
服务器可以是法语或英语,客户端也可以。
法国客户端(“2011年12月31日”)发送到英文服务器(“2011月12日”)的日期无法识别。反之亦然。
如何避免.NET中出现这样的问题。
您是否同时控制客户端和服务器?如果是这样的话,只需就一种形式和文化达成一致——我建议使用不变的文化——并明确确保双方都遵守它。
使用不变区域性,您可以很容易地在.NET中解析和格式化-查找ToString
和parse
/TryParse重载,这些重载包括IFormatProvider
参数。
使用Ticks属性在客户端和服务器之间发送它。这是一个数字,无论你想将日期设置为什么格式,它都将始终相同。
你把日期作为字符串发送的原因是什么?最好的方法是使用DateTime数据类型共享日期。如果出于任何原因,您可以只发送字符串,最好是将日期值转换为LongDateFormat,然后进行传输,可以在另一端对其进行解析以获得有意义的日期。
In php (or maybe gettext in general), what does gettext do when it sees a variable to dynamic content? I have 2 cases in mind. 1) Let s say I have <?=$user1?> poked John <?=$user2?>. ...
Reading the question Why doesn’t C++ STL support atoi(const string& ) like functions?, I encountered a comment which warned that GCC (at least) has a bug that can slow down multi-threaded ...
My company uses an internally developed package to support internationalization/localization. However, it was developed some twenty years ago, and the libraries are restricted to one product line. I m ...
How does Vistalizer manage to override the language limit in Windows Vista Home edition. Which api s does it use to allow installation of Multiple language packages.
I m converting an existing table such as this: CREATE TABLE `example`(`id` int(10) unsigned NOT NULL AUTO_INCREMENT, `column1` char(32) COLLATE latin1_general_ci NOT NULL ...
I am developing a Struts 2 application with support for multiple languages. If one of the domain objects needs to throw an exception, how can it do so in such a way that the error message is no ...
Has anyone gotten the Globalize plugin to work Rails 2.3.2 or later? If so, could you direct me to some useful info?
I received the following query from a customer: I am doing some research into character sets for future versions of our products. Most of the sites we have built use html including a ...