There are four SM_ENCODING_* environmental variables that can be set.
-
SM_ENCODING_SHELL indicates the encoding used by the shell, primarily useful for specifying what encoding is used for command line arguments.
-
SM_ENCODING_SYSTEM indicates the encoding used for internal interaction with the operating system.
-
Primarily dictates the encoding used for file system access.
-
Secondarily indicates the encoding used when internally accessing the environment.
-
-
SM_ENCODING_INPUT indicates the encoding used by stdin.
-
SM_ENCODING_OUTPUT indicates the encoding used by stdout and stderr.
Tuning the SM_ENCODING_INPUT and SM_ENCODING_OUTPUT values is primarily useful if you are redirecting or piping text somewhere other than the shell.
On UNIX the behavior is:
-
If SM_ENCODING_SHELL is not set, then its value will default to "UTF-8."
-
If SM_ENCODING_SYSTEM is not set, then its value will mirror SM_ENCODING_SHELL.
-
If SM_ENCODING_INPUT is not set, then its value will mirror SM_ENCODING_SHELL.
-
If SM_ENCODING_OUTPUT is not set, then its value will mirror SM_ENCODING_INPUT.
Note:In UNIX it generally makes sense to set all four values identically.
The following example sets the encoding to Shift_JIS.
export SM_ENCODING_INPUT=Shift_JIS export SM_ENCODING_OUTPUT=Shift_JIS export SM_ENCODING_SHELL=SHIFT_JIS export SM_ENCODING_SYSTEM=Shift_JIS