Help Center/ CodeArts Agent/ FAQs/ Agent/ What Should I Do If the Output Contains Garbled Characters?
Updated on 2026-07-27 GMT+08:00

What Should I Do If the Output Contains Garbled Characters?

Symptom

After you enter session content in CodeArts Agent, garbled characters appear in the generated output.

Cause Analysis

The terminal encoding is inconsistent with the program output encoding. In Windows, different code pages support different character sets. To avoid this issue, you are advised to set the terminal code page to 65001 (UTF-8).

Solution

  1. Set the terminal encoding to UTF-8.

    bash
    chcp 65001

    After that, start a new session and check whether the issue is resolved. If garbled characters persist, proceed to 2.

  2. Set the PowerShell console encoding to UTF-8.

    In PowerShell, character output uses the .NET Console.OutputEncoding property, not the CodePage setting of the Windows console.

    1. Check the .NET encoding used by PowerShell.
      [Console]::OutputEncoding
    2. Set the encoding to UTF-8.
      • Temporarily set the PowerShell output encoding to UTF-8.
        This setting takes effect only in the current session. After PowerShell is closed, the default setting is restored.
        [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
      • Permanently set PowerShell to use UTF-8 upon startup.

        If you want the encoding to be automatically set to UTF-8 each time you open PowerShell, add the following commands to the PowerShell profile:

        [Console]::InputEncoding  = [System.Text.Encoding]::UTF8
        [Console]::OutputEncoding = [System.Text.Encoding]::UTF8