StrByCharset

Description

Specifies how to convert string data between PowerBuilder Unicode strings and multibyte strings on the client.

Applies to

INF Informix

O90 Oracle9i

O10 Oracle 10g

ORA Oracle (for 11g and later)

Syntax

StrByCharset='value'

Parameter

Description

value

Specifies how to convert string data between PowerBuilder Unicode strings and multibyte strings on the client. Values are:

  • 0

    String conversion is based on the current OS code page, or, for UTF-8 code sets on Informix, on the UTF-8 code set.

  • 1

    For Informix, string conversion is based on the code set specified in the Client_Locale database parameter. For Oracle, string conversion is based on the Oracle character set specified in the NLS_Charset database parameter.


Default value

StrByCharset=0

Usage

Informix

The StrByCharset DBParm specifies how to convert string data between PowerBuilder Unicode strings and Informix client multibyte strings. By default, string conversion for UTF-8 code sets is based on the UTF-8 code set, and string conversion for non-UTF-8 code sets is based on the current OS code page. If StrByCharset is set to 1 (true), string conversion is based on the code set specified in the DBParm Client_Locale.

Example 1

With these settings:

StrByCharset=0
Informix Server DB_LOCALE='EN_US.8859-1'
PowerBuilder Informix client CLIENT_LOCALE='EN_US.8859-1'
OS code page=1252

The Informix client and server character sets match, so all string data from the client can be sent to the server and fetched back directly, even if some characters do not belong to the EN_US.8859-1 character set but are within code page 1252, because no string conversion happens between the Oracle client and server. All string data can be displayed using the OS code page. If StrByCharset is set to 1, when string data is converted between the Informix client (ANSI) and PowerBuilder (Unicode), characters that are not in the EN_US.8859-1 character set are not converted correctly.

Example 2

With these settings:

StrByCharset=0
Informix Server DB_LOCALE='DE_DE.ASCII'
PowerBuilder Informix client CLIENT_LOCALE='DE_DE.ASCII'
OS code page=949 for Korean

The client and server character sets match. All string data, including Korean characters, are sent or received one byte at a time so no data is lost. Using the Korean OS code page, all Korean string data can be converted from ANSI to Unicode safely with StrByCharset set to 0.

Example 3

With these settings:

StrByCharset=1
Informix Server DB_LOCALE='ZH_TW.BIG5'
PowerBuilder Informix client CLIENT_LOCALE='ZH_TW.BIG5'
OS code page=1252

Because characters in the ZH_TW.BIG5 character set do not belong to code page 1252, string data conversion must be based on the ZH_TW.BIG5 character set.

Oracle

The StrByCharset DBParm specifies how to convert string data between PowerBuilder Unicode and OCI client multibyte strings. By default, string conversion is based on the current OS code page or an Oracle character set. The StrByCharset database parameter is ignored if NLS_Charset is set to Unicode because both PowerBuilder and the OCI client use the UTF-16 format. When NLS_Charset is set to another value, you must set StrByCharset to 1 if the character set on the client is incompatible with the OS code page.

Example 1

With these settings:

StrByCharset=0
Oracle Server NLS_CHARACTER='WE8ISO8859P1'
PowerBuilder OCI client NLS_CHARSET='WE8ISO8859P1'
OS code page=1252

The Oracle client and server character sets match, so all string data from the client can be sent to the server and fetched back directly, even if some characters do not belong to the WE8ISO8859P1 character set but are within code page 1252, because no string conversion happens between the Oracle client and server. All string data can be displayed using the OS code page. If StrByCharset is set to 1, when string data is converted between the OCI client (ANSI) and PowerBuilder (Unicode), characters that are not in the WE8ISO8859P1character set are not converted correctly.

Example 2

With these settings:

StrByCharset=0
Oracle Server NLS_CHARACTER='US7ASCII'
PowerBuilder OCI client NLS_CHARSET='US7ASCII'
OS code page=949 for Korean 

The client and server character sets match. All string data, including Korean characters, is sent or received one byte at a time so no data is lost. Using the Korean OS code page, all Korean string data can be converted from ANSI to Unicode safely with StrByCharset set to 0.

Example 3

With these settings:

StrByCharset=1
Oracle Server NLS_CHARACTER='ZHT16BIG5'
PowerBuilder OCI client NLS_CHARSET='ZHT16BIG5'
OS code page=1252

Because characters in the ZHT16BIG5 character set do not belong to code page 1252, string data conversion must be based on the ZHT16BIG5 character set.

Examples

To specify that the Informix client should use the fr_FR.8859-1 character set defined by the Client_Locale parameter to handle string datatypes:

  • Database profile

    Specify fr_FR.8859-1 in the Client Locale box and select the String Conversion Based on Client Locale box on the Regional Settings page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="Client_Locale='fr_FR.8859-1',StrByCharset=1"

To specify that the OCI client should use the character set defined by the NLS_LANG parameter on the local computer to handle string datatypes:

  • Database profile

    Select Local from the NLS Charset drop-down list and select the Use String Conversion Based on Oracle Character Set box on the System page in the Database Profile Setup dialog box.

  • Application

    Type the following in code:

    SQLCA.DBParm="NLS_Charset='Local',StrByCharset=1"

See also

Client_Locale

Db_Locale

NLS_Charset