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
- 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.
- 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.
- Check the .NET encoding used by PowerShell.
[Console]::OutputEncoding
- Set the encoding to UTF-8.
- Temporarily set the PowerShell output encoding to UTF-8.
- 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
- Check the .NET encoding used by PowerShell.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot