Question
Steve Riddle · Aug 10

UNicode and 8-bit databases

Is anyone aware of how to find out if a UNICODE database has been installed on an 8-bit version of IRIS i.e. is there a way of checking and actual database rather than the IRIS instance version?

Product version: IRIS 2022.1
0
0 154
Discussion (4)3
Log in or sign up to continue

There isn't any flag telling whether a database is Unicode or not inside the database file. If a Unicode database has no UNICODE characters, it will be accessible by an 8-bit version without problems. 

If you want to know if a database has wide characters (Unicode chars), you could try to read all the globals inside an 8-bits instance and wait for a <WIDE CHAR> error. In order to read all the globals, there are several alternatives, like building a small routine, doing a backup and/or restore, exporting/importing globals, etc. Of course, there are more elegant ways to check the globals and data than expecting an error. 

Of course, there are more elegant ways to check the globals and data than expecting an error.

Mario, you left me curious. What are the ways?

I am a little surprised you asked this :-P ..... and the answer, as you can imagine, is using the magical $Z functions! 

In this case, searching a little you can find: 

$ZISWIDE (ObjectScript)

Checks whether a string contains any 16-bit wide characters. 

See: 

https://docs.intersystems.com/iris20221/csp/docbook/Doc.View.cls?KEY=RCO...

I think playing with other functions could give you what we are looking for here.

Therefore, now that we have a utility that can check if something is Unicode or not, the rest would be to do a routine to read all the globals and check for the content with this function. I have seen routines getting all the globals and looping before but don't have it handy.

This programmatic way of looping and checking all the globals gives you more control and allows you to find where there is something not expected. But, as it takes some time to write if the original question is something you just want to do once, a backup + restore seems quicker and simpler.

if it is a straight 8bit DB  you have the challenge to find out
how characters beyond the primitive 7bit ASCII are stored  e.g. ÀöÜß € ¡¿ è & é ç
is it ISO Latin 1 , 2 ,3 4, 5 ... or any of the horrible Win encondings