如何在整个VB 6.0应用程序中支持Unicode字符

前端之家收集整理的这篇文章主要介绍了如何在整个VB 6.0应用程序中支持Unicode字符前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在VB 6.0应用程序中遇到了Unicode字符不支持的问题.我需要在我的应用程序中的记录集字段中设置中文字符 – (每个字段的大小是从程序本身设置的).如果我们将中文字符设置到记录集字段中,则会出现多步操作错误(因为保持字段大小不够).如果我们从服务器控制面板的区域设置中将语言设置为中文(控制面板>区域和语言设置>管理选项卡>更改系统区域设置…>到中文),则不会触发此错误

如果我们设置这个,那么我们的应用程序的时间设置将会改变.我需要一些帮助,从控制面板更改我们如何解决这个问题.

请帮忙.

提前致谢.

解决方法

Windows中,您可以将区域设置设置为中文,同时保留时间和日期格式. http://www.techpavan.com/2009/04/07/change-time-format-windows/

为了在Visual Basic 6应用程序中使用Unicode,这里有一篇文章,详尽的解释和示例:http://www.example-code.com/vb/vbUnicode1.asp

引用此链接

Internally,VB6 stores strings as Unicode. Your VB6 program is capable of manipulating strings in any language containing any character — whether it’s Chinese,Japanese,Icelandic,Arabic,etc. It’s fully Unicode capable. A single string may contain characters in multiple languages. You can save these strings to databases,files,etc.,and there shouldn’t be a problem. Problems arise only when trying to display (i.e. render the glyphs) for foreign characters in the standard VB6 controls.

When displaying a string,the standard VB6 textBox and label controls do an implicit (and internal) conversion from Unicode to ANSI. This is the confounding behavior that causes all the trouble. Internal to VB6,the runtime is converting Unicode to the current Windows ANSI code page identifier for the operating system. There is no way to change this conversion short of changing the ANSI code page for the system.

The standard VB6 textBox and label controls display the ANSI bytes according to a character encoding that you can specify. After the Unicode-to-ANSI conversion,VB6 then attempts to display the character data according to the control’s Font.Charset property,which if left unchanged is equal to the ANSI charset. Changing the control’s Font.Charset changes the way VB6 interprets the “ANSI” bytes. In other words,you’re telling VB6 to treat the bytes as some other character encoding instead of “ANSI”. Note: VB6 is capable of displaying characters in all the major languages. It simply needs to be told to do so,and the correct bytes need to be in place internally for it to happen.

猜你在找的VB相关文章