The default encoding format is GBK.
Usage Scenarios
The default system encoding format of the FW is GBK. In this format, users can enter only characters (Chinese and English characters) in the GBK encode table when configuring parameters such as policies names and user names on the FW. The characters of other languages (such as German and French) are not supported. When the FW interconnects with a third-party system, for example, an authentication server on which user names contain non-GBK characters, the user names cannot be imported to the FW, and the users cannot log in to the FW. If non-GBK characters (such as German or French) need to be used, you can run the language character-set utf-8 command on the FW to switch the encoding format to UTF-8.
Prerequisites
This command is available only when the current language mode (language-mode) is English.
Precautions
If only GBK-supported characters are used, do not switch the encoding format. Especially in the Chinese environment, once the encoding format is switched, the Chinese web UI and CLI are unavailable.
After the UTF-8 encoding format is used, note that the encoding format of the CLI terminal software must be set to UTF-8 as well. Otherwise, entered characters may be displayed as garbled characters.
The FW's character encoding format must be consistent with that of the interconnected third-party system, such as the authentication server. Otherwise, the interconnection fails if there are non-ASCII characters.
If the encoding format is switched to UTF-8 when the device already has service configurations, some configurations may fail to be transcoded. To resolve this problem, the FW provides the following method:
Specify the original encoding format of the existing configuration.
When configuring the device using the CLI, administrators can set multiple encoding formats in the terminal software, and the configurations are stored on the device in the corresponding encoding formats. Before transcoding, run the set old-encoding-charset mode { gbk | utf-8 } command to specify the original encoding format, so that the FW can perform the transcoding. Currently, the original encoding format can be GBK or UTF-8. That is, other encoding formats may not be properly transcoded to UTF-8. If the original encoding is unknown, specify any encoding format and run the display language charset conversion preview command to preview the configuration conversion result. If the result is normal without garbled characters, the specified original encoding format is correct.
As the configuration delivered through the web UI can only be in the GBK format, while the configuration delivered through the CLI can be in the UTF-8 format (depending on the CLI terminal), these two encoding formats may co-exist on the device. In this case, even if the original encoding format is specified, not all configurations can be successfully transcoded.
View the configurations that are not properly transcoded and modify them.
If the system informs you of transcoding failures on certain configurations, run the display language charset exception configuration command to view the exception configurations, delete or modify such configurations, and perform transcoding again. The exception configurations include overlong configurations after transcoding and configurations that cannot be transcoded. UTF-8 is a variable-length encoding format. Each character contains 1 to 6 bytes. After the encoding format is switched to UTF-8, some character strings entered in the previous GBK format may fail to be transcoded because their length exceeds that for UTF-8.
# Switch the system encoding format to UTF-8.
<sysname> system-view [sysname] language character-set utf-8 Warning: Note the following points when setting the encoding mode to UTF-8: 1.Set the encoding mode to the original one first. The default encoding mode is GBK. 2.The UTF-8 mode is not applicable to the working environment in Chinese. After code conversion, the Chinese UI is unavailable. 3.You cannot switch to the original encoding mode after setting the encoding mode to UTF-8. 4.When different encoding modes exist, the encoding modes may be incompatible after code conversion. 5.After the encoding is complete, the encoding configuration is automatically saved. If the current configuration is different from those in the configuration file for next startup, back up the startup file.(Check inconsistent configurations command: compare configuration) 6.The code conversion takes a long period. Do not perform other configurations or disconnect the power supply during the period. Are you sure to continue?[Y/N]y Info:The original encoding mode of the device is GBK. Prepare the backup configuration. Info:Successful backup configuration to "hda1:/charset_backup/charset_back.cfg". //Backup the current configuration. Checking the configuration compatibility. Info:No exception configurations are found. //The information is displayed if the device needs to be restarted. Warning:After the encoding is complete, the encoding configuration is automatically saved, and the device is automatically restarted. Are you sure to continue the switching?[Y/N]y //The information is displayed if the device does not need to be restarted. Warning:After the encoding is complete, the encoding configuration is automatically saved. Are you sure to continue the switching?[Y/N]y Info:The system starts configuration conversion. Please wait. During this period, do not disconnect the power supply. Info:The configuration conversion is complete. The encoding mode is UTF-8.