Setting the return string mode for hooks and scripts

HCL Compass Core handles strings in Unicode rather than the local character set (also known as the local code page) setting. This may have an impact on existing hooks and scripts that require string return values to be in the local character set.

You can select a return string mode for specifying how characters in strings are returned from HCL Compass API hooks and scripts. The return string mode controls the set of allowable characters that can be returned in the string, and for Perl also controls the encoding format of the string. The default setting is local return string mode for both Perl and VBScript.

  • Local return string mode (RETURN_STRING_LOCAL) returns strings that are in the local character set and exceptions are raised rather than causing corruption in returned characters (for returned characters that are not in the local character set).
  • Unicode return string mode (RETURN_STRING_UNICODE) returns Unicode strings. No data translation occurs and any character that is in the HCL Compass data code page of the database set may be returned.

VBScript uses Unicode strings regardless of whether the mode is set to RETURN_STRING_UNICODE or RETURN_STRING_LOCAL. If the return string mode for VBScript is local, an exception is thrown if a string is not in the local character set (even though it is passing back a Unicode string). Note that while the strings are always Unicode, Visual Basic applications may not be expecting characters that are outside the local character set, so RETURN_STRING_LOCAL means that HCL Compass only passes back characters that are representable in the local character set.

Perl uses local code page character encoding if the return string mode is local (RETURN_STRING_LOCAL) and uses UTF8 if the return string mode is Unicode (RETURN_STRING_UNICODE).

Each scripting language has its own setting independent of the other. For example, the Perl return string mode can be set to RETURN_STRING_LOCAL and the VBScript return string mode can be set to RETURN_STRING_UNICODE.