Use > Server Automation > SA Global Shell > Character encoding for the OGFS

Character encoding for OGFS

To support international environments, the OGFS can display information in different character encodings such as Shift-JIS (Japanese) and EUC-KR (Korean). You can control the encoding of Global Sessions in the following ways:

  • To specify the encoding of your Global Shell sessions, in the Terminal and Shell Preferences of the SA Client, select an item from the Encoding drop-down list.
  • To change the encoding of an active Global Shell session, run the swenc command with the -e option.

If you change the encoding of an active session, you must also change the encoding of the terminal application for that session. This procedure varies according to the terminal application.

Terminal application configuration

The terminal application that is hosting a Global Shell or Remote Terminal session must be configured to use the same encoding expected by the session. If the encodings do not match, the data might be displayed incorrectly.

When the SA Client launches the terminal application, it composes the command specified by the Terminal Client field in the Terminal and Shell Preferences. If the Terminal Client field includes the %e substitution variable, the SA Client replaces %e with an encoding name. For Global Shell sessions, this encoding name is specified by the Encoding field of the Terminal and Shell Preferences. For Remote Terminal sessions, this encoding name is the value of the Encoding field in the Properties section of the Device Explorer. If the terminal application does not support the encoding that replaces the %e variable, or if the %e variable is not specified, you must change the encoding manually in the terminal application after it starts.

Data that cannot be displayed

Data that cannot be displayed might be from a managed server (such as the contents of files) or it might be the name of an object in the SA model. If the session’s encoding does not support the data to be displayed, the data often appears as question marks. (However, it might appear as other characters such as exclamation points.) The session attempts to display this data with the current encoding. Usually, this data cannot be accessed. To access this data, select a compatible encoding for the session.

Objects in the SA model, such as Facility and Server, appear as file names in the OGFS. If these file names contain characters that cannot be represented by the encoding of the session, they are displayed as question marks, appended by the Object ID of the object. In the following example, the IDs are 10002 and 11002:

New York

Paris

Montr?al~10002

??~11002

If the model object does not have an ID, such as a custom attribute, then the session attempts to display the name with the current encoding.

LANG and LC_CTYPE environment variables

Many UNIX commands (such as ls) rely on the character encoding, which is determined by the LANG or LC_CTYPE environment variables. In a Global Session, if the encoding is changed with the swenc command, the system attempts to reset these variables.

Server Automation determines the new value of the LANG variable with the following process:

  1. The value of LANG is generated by combining the language of the user’s profile in the SA Client with the current session encoding. For example, if the language is English and the session encoding is UTF-8, LANG is set to en_US.utf8.
  2. The value determined by the preceding step is compared with the set of valid locales on the OGFS server (according to the output of locale -a). If the value is a valid locale, LANG is set to this value.
  3. If the value is not a valid locale, the system attempts to find a valid locale that specifies the user’s language without the encoding. For example, if the user’s language is English and the session encoding is EUC-JP, and this combination does not form a valid locale, LANG is set to en_US. If no matching locale is found, LANG is left unspecified.

The new value of the LC_CTYPE variable is determined in the following order:

  1. Server Automation attempts to find a valid locale that matches the session encoding, regardless of the language.
  2. If a valid locale is found, LC_CTYPE is set to this locale. For example, if the session encoding is EUC-JP, the LC_CTYPE variable is set to ja_JP.eucjp.
  3. If no matching locale is found, LC_CTYPE is left unspecified.
  4. If Server Automation cannot set the LANG or LC_CTYPE variables with the preceding process, you should set them manually.

Transcoded data in a managed server

Transcoding is the conversion of data from one character encoding to another. Server Automation automatically transcodes some of the data between Global Shell sessions and other sources of data. For example, the file names of managed servers are transcoded, but the contents of the files are not. To see which data is transcoded, see the following table. To display the transcoding mode of the current Global Shell session, enter the swenc command with no options.

Data transcoded for Global Shell sessions

Data

Transcoding

Objects in the SA model space, such as Facility, Customer, and Server. These objects are stored in the SA Model Repository (database) in UTF-8.

Between UTF-8 and the session encoding.

File and directory names of managed servers.

Between the managed server encoding and the session encoding.

Metadata of managed servers, such as user names and registry key names.

Between the managed server encoding and the session encoding.

File contents of managed servers.

None

Contents of Windows registries, services, COM objects, and IIS metabases.

None

rosh: Contents of saved scripts executed on managed servers (a rosh push operation).

None

rosh: Ad-hoc scripts executed on managed servers.

None

rosh: Command-line arguments to programs executed on managed servers.

None

rosh: Data streams (such as stdin and stdout) of programs executed on managed servers.

None

rosh: Data streams of rosh jump operations.

None

OGFS home, tmp, and var/tmp directories.

None

Disabling the transcoding of managed server data

On UNIX servers, file and directory names can contain characters in arbitrary encodings. When accessed through the OGFS, file and directory names are transcoded by Server Automation. If the encoding of the names does not match the default encoding of the managed server, the transcoded data might be unusable.

You can disable transcoding with the swenc command. To turn transcoding on or off, use the -T option:

swenc -T {on | off}

If transcoding is disabled, file and directory names are passed unmodified from the managed servers. Therefore, you must manually configure the encoding of the terminal application to display the names correctly.

Windows servers store their file system data internally in the UTF-16 encoding. Because the encoding is known, transcoding is performed correctly and does not need to be disabled. Therefore, the -T option of the swenc command has no effect on Windows servers. For more information, see swenc syntax.