< Home

Switching the System Character Encoding Format Using the CLI

The default system character encoding format is GBK. In this format, users can enter only Chinese and English characters in the GBK encode table when configuring parameters such as policies names and user names. The characters of other languages (such as German and French) are not supported. If a language that GBK does not support is used, switch the system character encoding format to UTF-8.

Prerequisites

The encoding format can be switched only in English mode (language-mode).

Context

If no GBK-unsupported characters are used, do not switch the encoding format. Once the encoding format is switched, the Chinese web UI and CLI are unavailable.

If the UTF-8 format is required, you are strongly recommended to switch the default format to UTF-8 before configuring any services. Otherwise, some configurations may not be automatically transcoded. In addition, if the device has user authentication-related or SSL VPN configurations, the device will be restarted during transcoding, interrupting services.

You cannot switch the UTF-8 encoding format back to GBK unless you restore the configuration file and database that was previously backed up. Therefore, exercise cautions for transcoding.

Switching the System Character Encoding Format (Single-Device Networking)

  1. Optional: In the system view, specify the original encoding format. For a new device without service configurations, ignore this step.

    [sysname] set old-encoding-charset mode { gbk | utf-8 }
    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 switching the encoding format to UTF-8, specify the original encoding format, so that the FW can perform 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 FW. In this case, even if the original encoding format is specified, not all configurations can be successfully transcoded.

  2. Switch the encoding format to UTF-8.

    [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.     //This has been completed in step 1. The default 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. 

    If "Error: Exception configurations are detected. Perform code conversion again after deleting the exception configurations." is displayed during configuration compatibility check, some configurations cannot be properly transcoded. In this case, you must run the following command to view exception configurations, delete or modify them, and perform the transcoding command again until "No exception configurations are found." is displayed.

    <sysname> display language charset exception configuration
    Module[Security-Policy]:AbnormalCmdNum<1>,Check Error                           
      Vsys[public],Cmd:rule name XXXX
    

    The command output indicates that the rule name configured using the rule name XXXX command for the security policy module. This configuration must be deleted or modified.

    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.

    In the report scheduling configuration, if the name of the customized report (log custom-report policy policy-name) contains non-ASCII characters (except letters, digits, and symbols) or the report language mode (custom-report language { chinese | english }) is Chinese, the system displays a message indicating that the encoding format cannot be switched. In this case, delete or modify the report scheduling configuration and then switch the encoding format. The name of a customized report can contain only ASCII characters.

    During encoding format switching, the FW automatically backs up the original configuration file and user management database to the /charset_backup directory.

    <system> cd /charset_backup
    <system> dir                                                                                                 
             Idx  Attr     Size(Byte)  Date        Time       FileName                                                                         
        0  -rw-         35,840  Nov 03 2017 15:30:34   usermanage.db                                                                    
        1  -rw-         59,141  Nov 03 2017 18:20:00   charset_back.cfg  
    

    If the original configuration file has the SSL VPN configuration, the database cannot be rolled back. Therefore, the encoding format cannot be switched backed to GBK. If the original configuration file does not have the SSL VPN configuration and you have to switch back the encoding format, perform the following steps. Exercise caution before performing encoding format switching to prevent the rollback operation. The rollback operation is complex and has a specific risk.

    1. Set the backed up configuration file charset_back.cfg as the configuration file for next startup.
    2. Copy usermanage.db to the umdb/umsystem/ directory to overwrite the user database.
    3. For the USG6000E, you need to run the delete log sdb command in the system view delete the log-related file.
    4. Restart the device.

Switching the System Character Encoding Format (Active/Standby Backup Networking)

The device may be restarted during transcoding, to prevent service interruption, you should perform transcoding on the standby device first, manually switching between the active and standby devices, and perform transcoding on the original active device.

The device is restarted only when there are configurations related to user authentication. The device automatically determines whether a restart is needed. If needed, the device displays a message, indicating that transcoding can be performed only on the standby device.

During transcoding, do not deliver configurations irrelevant to transcoding on the active or standby FW. Otherwise, the configuration backed up from the active device may inconsistent with that on the standby device.

  1. Log in to the standby device and switch the encoding format to UTF-8 according to the procedure described in Switching the System Character Encoding Format (Single-Device Networking).
  2. Log in to the active device and shut down a service interface, such as GigabitEthernet 0/0/1, to trigger an active/standby switchover.

    HRP_M[sysname] interface GigabitEthernet 0/0/1 
    HRP_M[sysname-GigabitEthernet 0/0/1] shutdown 
    

  3. Switch the encoding format to UTF-8 on the currently standby device according to the procedure described in Switching the System Character Encoding Format (Single-Device Networking).
  4. After the currently standby device restarts, run the undo shutdown command on GigabitEthernet 0/0/1.

    HRP_S[sysname] interface GigabitEthernet 0/0/1 
    HRP_S[sysname-GigabitEthernet 0/0/1] undo shutdown 
    

Switching the System Character Encoding Format (Load Balancing Networking)

The device may restart during transcoding. The restart in the load balancing networking will directly interrupt services. To prevent service interruption, you must switch the working mode to active/standby and perform transcoding on the standby device and then on the active device.

The device is restarted only when there are configurations related to user authentication. The device automatically determines whether a restart is needed. If needed, the device displays a message, indicating that transcoding can be performed only on the standby device.

During transcoding, do not deliver configurations irrelevant to transcoding on the active or standby FW. Otherwise, the configuration backed up from the active device may inconsistent with that on the standby device.

  1. Log in to either device and shut down a service interface, such as GigabitEthernet 0/0/1, to trigger an active/standby switchover.

    HRP_S[sysname] interface GigabitEthernet 0/0/1 
    HRP_S[sysname-GigabitEthernet 0/0/1] shutdown 
    

  2. Switch the encoding format to UTF-8 on the standby device according to the procedure described in Switching the System Character Encoding Format (Single-Device Networking).
  3. After the standby device restarts, run the undo shutdown command on GigabitEthernet 0/0/1.

    HRP_S[sysname] interface GigabitEthernet 0/0/1 
    HRP_S[sysname-GigabitEthernet 0/0/1] undo shutdown 
    

  4. Log in to the other device (active) and shut down a service interface, such as GigabitEthernet 0/0/1, to trigger an active/standby switchover.

    HRP_M[sysname] interface GigabitEthernet 0/0/1 
    HRP_M[sysname-GigabitEthernet 0/0/1] shutdown 
    

  5. Switch the encoding format to UTF-8 on the currently standby device according to the procedure described in Switching the System Character Encoding Format (Single-Device Networking).
  6. After the currently standby device restarts, run the undo shutdown command on GigabitEthernet 0/0/1.

    HRP_S[sysname] interface GigabitEthernet 0/0/1 
    HRP_S[sysname-GigabitEthernet 0/0/1] undo shutdown 
    

Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic