加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Windows > 正文

在Windows7下使用Delphi7程序发生奇怪的区域性/日期时间问题

发布时间:2020-12-14 04:28:12 所属栏目:Windows 来源:网络整理
导读:我的Delphi7程序是非英语语言,并广泛使用一些Win1250 ANSI字符. (aáíó??) 我注意到在英语Windows XP / Vista / 7系统中,许多重音字符在表单和标签字幕中显示为非重音字符(即:o而不是?,而不是?). 在本地化的Windows XP / Vista系统上没有问题.但是在某些W
我的Delphi7程序是非英语语言,并广泛使用一些Win1250 ANSI字符. (aáíó??)

我注意到在英语Windows XP / Vista / 7系统中,许多重音字符在表单和标签字幕中显示为非重音字符(即:o而不是?,而不是?).

在本地化的Windows XP / Vista系统上没有问题.但是在某些Windows 7系统上(可能只有64位版本,我不确定)即使Windows实例已本地化,重音字符也不会正常显示.

我还注意到,在这些系统上,DateToStr将输出11/17/2010而不是2010.11.17 – 这是标准的本地化格式.
有趣的是,我在区域设置下检查了它,默认日期格式设置为yyyy.mm.dd – 为什么DateToStr会给我回dd / mm / yyyy?

我注意到货币的相同行为(“,”显示为小数点分隔符而不是“.”等).

有任何想法吗?

谢谢!

解决方法

I have noticed that under English
language Windows XP/Vista/7 systems
many accented characters appear
non-accented (ie.: o instead of ?,u
instead of ?) in Form and Label
Captions.

Delphi 7应用程序是非unicode(除非您使用TNT组件之类的组件),因此您需要在Windows中检查非Unicode应用程序的活动CodePage.在Win7中,转到“控制面板”|地区和语言|行政|更改系统区域设置,并更改Windows的默认ANSI CodePage.

What I’ve also noticed is that on
these systems DateToStr will output
11/17/2010 instead of 2010.11.17 –
which is the standard localized
format. The funny thing is that I’ve
checked it under the regional
settings,and the default date format
is set to yyyy.mm.dd – why is
DateToStr giving me back dd/mm/yyyy
instead?

这似乎与以下报告相同:
http://social.technet.microsoft.com/Forums/en-US/w7itprogeneral/thread/b4f90f07-206c-494b-8d14-ee17bfa689e0

它似乎是Windows中的一个错误.我在为斯洛文尼亚客户编写的一个项目中遇到了同样的问题.我告诉客户将当前日期/时间设置更改为不同的设置,保存更改,然后返回日期/时间设置,并将其更改回所需的格式.那样可以解决问题.

同样在上面的链接中,提到了编程解决方法:

来自S.B.Christensen:

Hi Tim

I just had the same issu as you (also
doing Delphi development).

If you wish to avoid your users to do
the workaround themselves,use the
following unit as the first in your
project:

unit Win7;

interface

uses SysUtils,Windows;

implementation

initialization
SetThreadLocale(LOCALE_USER_DEFAULT);
GetFormatSettings;
end.

我自己没有测试过代码,因为以前的解决方法对我来说很好.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读