Tips   >   Unicode   >   Unicode (All Contents)

Unicode

This section covers topics relating to the unicode version of Omnis Studio.

isunicode() Function

The isunicode() function was introduced in Omnis Studio version 4.1.

I was curious what would happen with a 4.0 version of Omnis Studio if it hit the isunicode() function in a library created in 4.1.

Here's what happens:

The isunicode() function becomes () and returns false.

; Unicode test in 4.1 or greater
If isunicode()
  OK message {unicode}
Else
  OK message {non-unicode}
End If

; Same function when opened in 4.0
; The result is false, so the test is okay in 4.0
If ()
  OK message {unicode}
Else
  OK message {non-unicode}
End If

Register DLL - Unicode Folder Paths

If you use Register DLL to get file paths, you will need to modify your code for the unicode version of Omnis Studio.

With unicode version you will probably need to use the WIDE unicode calls.

SHGetFolderPathW instead of SHGetFolderPathA

The following is an example of what I had to do for the method which returns the path to the user preferences folder on the Windows platform.

If isunicode()
   Register DLL ('shfolder.dll','SHGetFolderPathW','NJJJJC') Returns ErrCode
   If not(ErrCode)
      Call DLL ('shfolder.dll','SHGetFolderPathW',Handle,28,'#NULL#',0,Path) Returns ErrCode
   End If
Else
   Register DLL ('shfolder.dll','SHGetFolderPathA','NJJJJC') Returns ErrCode
   If not(ErrCode)
      Call DLL ('shfolder.dll','SHGetFolderPathA',Handle,28,'#NULL#',0,Path) Returns ErrCode
   End If
End If

StudioTips Members can download the oPaths library which includes

sys(2) and Unicode

I use the sys(2) function to test whether the developer version or runtime version of Omnis Studio was being used. I soon discovered with my unicode version of Omnis Studio that the above test doesn't work for unicode. sys(2) is the sum of the possible bits as follows: