UTF-8 / Unicode & DBCS
Unicode Translation  
   
Translating to/from Unicode The TRANSLATE directive has been extended to convert the extended data between DBCS and UNICODE. The new format for the Translate directive is:

TRANSLATE FROM <inputstr> [, TBL=nn ] TO <strvar$> [, TBL=nn ]

This directive can be used to translate data from DBCS to UNICODE, UNICODE to DBCS, or two different DBCS forms (different codepages). It will take the string provided in <inputstr> and convert it into <strvar$>. Various options exist:

  • If no TBL= options are specified, the system will translate DBCS from <inputstr> to UNICODE into <strvar$>. It will use the current default codepage to accomplish this translation.
  • If a TBL= option exists only on the <inputstr>, the data will converted from DBCS to UNICODE based on the codepage table specified.
  • If a TBL= option only on the <strvar$> the system will convert UNICODE to DBCS using the codepage table specified.
  • If the TBL= option exists on both, the data will be translated from DBCS to DBCS changing the codepage table.

If desired you can specify TBL=* to indicate that you want to use the current default codepage.

Examples:

TRANSLATE FROM USER_INPUT$ TO DB_DATA$

  • Convert USER_INPUT$ from DBCS to UNICODE into DB_DATA$

TRANSLATE FROM DB_DATA$ TO USER_OUTPUT$,TBL=*

  • Convert DB_DATA$ from UNICODE to DBCS into USER_OUTPUT$
    conversion based on current character set chosen by the user.
Limitations Prresently, the extended character support is limited to the Windows version of PxPlus or when using WindX in any supported server configuration. JavX does not support the use of the Extended Character set.

The TRANSLATE directive and TCB values are ONLY available on a Windows system.