Unicode problem

I have to develop an application using Arabic Interface. For this I am using Microsoft Forms 2.0 object Library and also changed the settings in Control Panel Regional Settings. I am using unicode for the first time. I am not sure about the approach or the way to do the same. Can anyone tell me the correct way to store in Unicode so that it is language independent.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VB6 cannot display unicode characters.
You need to use 3rd party controls to do so.
MS Office has FM20.dll that is able to show unicode, but ppl need an MS Office license to use it.

Sources for third party Unicode controls:
1. UniSuite at http://www.cyberactivex.com
2. UniToolBox at http://www.unitoolbox.com/
3. Forms 2.0 Object Library.
   FM20.Dll - Microsoft® Office users already have Forms 2.0 Object Library installed. If not you can download and install it free as part of ActiveXControlPad at http://download.microsoft.com/download/activexcontrolpad/Install/
   FM20ENU.Dll - Automatically installed with English versions of Office. Users who have installed Office with another language should check Windows\System32 folder for presence of this file. If it is not present you can download and install it free as part of ActiveXControlPad.
   Note: You must have FM20ENU.Dll present to make Forms 2.0 Object Library controls available in Vb6. In the IDE you will receive an error while attempting to place the control on a Form. Typical messge is System Error &H8007007E(-2147024770).
VB6 controls cannot display Unicode characters, no, but VB6 uses Unicode for all its strings -- that is why there is LenB, ChrW, et al counterparts to many of the functions.

The Microsoft Forms 2.0 object Library and FM20.DLL are the same thing.  

When you say 'store' in Unicode, do you mean to a text file?  If so, do you know how to use the File System Object?  You can use it to store in UTF16/Unicode.  Place a reference to the Microsoft Scripting Runtime in your code and try the following small example of this in action:

      Dim myFSO as New Scripting.FileSystemObject
      Dim myTextStream as Scripting.TextStream

      Set myTextStream = myFSO.OpenTextFile("x:\mypath\myunicodefile.txt", ForWriting, True, TristateTrue)

            myTextStream.Write "My Ứתїč○đﻉ text"

      Set myTextStream = Nothing
      Set My FSO = Nothing

The CreateTextFile() method of the FileSystemObject has the following properties:

      CreateTextFile(Filename As String, IOMode As Enum, CreateIfNotExist As Boolean, TristateFormat As Enum)

Use ForWriting, ForReading, ForAppending as the IOMode and TriStateTrue for Unicode, TriStateFalse for ASCII, TriStateUseDefault for System Default.

For more info on the FSO, go to http://msdn.microsoft.com/library/en-us/script56/html/FSOoriFileSystemObject.asp

You may also want to look up the APIs WideCharToMultibyte() and MultibyteToWideChar(), from http://www.allapi.net, but it depends how far you want to go...



Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ooops, it looks like these pages don't show unicode text, either!!  Typical.  This line:

        myTextStream.Write "My Ứתїč○đﻉ text"

was a fancy unicode line of text.  Recreate it by changing that line to:

        myTextStream.Write "My " & ChrW(7912) & ChrW(1514) & ChrW(1111) & ChrW(269) & _
                                       ChrW(9675) & ChrW(273) & ChrW(65225) & " text"

to see why I'm so disappointed!! ;-)

ubbottAuthor Commented:
Hi Jimbobmcgee..
Thanks for the comments. I had worked with FSO. In the example you had stored some data in text file using Cherw(). It works but if we have to use some database say SQL then can same is applied to that and moreover the way to read a unicode stored database.

I would have thought that, if the database fields will store a Unicode string (an nVarchar, for example), it would be OK.  As far as I know, the ADODB.Recordset object is Unicode-compliant.  VB6 String variables certainly are.  

As such, I imagine you could pull data from Unicode fields into a recordset and output data using the FSO method...


It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.