4

I am facing a problem in my VB 6.0 application that Unicode characters are not supporting. I need to set Chinese characters in field of a recordset in my application-(size of each field is setting from program itself). If we are setting Chinese char into the field of recordset then getting Multiple-step operation error(because of the holding field size is not enough). This error will not fire, if we are setting language to Chinese from Regional settings from control panel in server (Control Panel > Region and Language setting > Administrative Tab > Change system Locale.. > to Chinese )

if we are setting this then time settings of our application will be change. I need some help with out changing from control panel how can we solve this problem.

please help.

Thanks in advance.

Ilya Kurnosov
  • 3,180
  • 3
  • 23
  • 37
Sajith A.K.
  • 716
  • 9
  • 21
  • See also this question [internationalisation of a vb6 application](http://stackoverflow.com/questions/830367/internationalization-of-a-vb-6-application) – MarkJ Aug 22 '13 at 13:26

2 Answers2

3

In Windows, you can set your regional settings to Chinese, while keeping the time and date format. http://www.techpavan.com/2009/04/07/change-time-format-windows/


For using Unicode in Visual Basic 6 applications, here is an article with thorough explanations and examples: http://www.example-code.com/vb/vbUnicode1.asp

Quoting this link:

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.

Community
  • 1
  • 1
mynetx
  • 878
  • 7
  • 25
  • Hi J.M., My application is non-Unicode, how will i make it as Unicode application with out changing the regional settings. That is what I am expecting. – Sajith A.K. Aug 22 '13 at 01:52
  • Added a section about this. – mynetx Aug 22 '13 at 08:52
  • 1
    +1 The full story of VB6's partial support for Unicode is explained in this document by Michael Kaplan: http://www.i18nwithvb.com/chapters/Chapter06_en.htm – MarkJ Aug 22 '13 at 13:22
  • Hi J.M.,This link is very useful, but I think you did not get my point. I does not have problem showing Chinese characters to label box or storing Chinese characters to string variable. I Have only the problem while Chinese character set to recordset. In each page i have recordset corresponds to the fields in that page and their size will be same as data base table field size. When assigning Chinese character to the one of the field that time getting the error : "Multiple-step operation error". How can i overcome this problem.This error will not fire when set the settings in control panel. – Sajith A.K. Aug 22 '13 at 15:37
-3

Try setting the font on those controls to Lucida Sans Unicode to add Unicode Support in.

PSXGamerPro1
  • 152
  • 10