Skip to content

UnicodeEncodeError on non-Chinese locale systems when importing prompts #297

@jovicdev97

Description

@jovicdev97

System Info / 系統信息

System Locale: DE/German
System Encoding: cp1252 (Windows-1252)
Python: 3.12.5 (64-bit, MSC v.1940)

Who can help? / 谁可以帮助到您?

No response

Information / 问题信息

  • The official example scripts / 官方的示例脚本
  • My own modified scripts / 我自己修改的脚本和任务

Reproduction / 复现过程

  1. Use a system with a non-Chinese locale (in my example german)
  2. Run any command

Actual Behavior
The application crashes on import with:

UnicodeEncodeError: 'locale' codec can't encode character '\u5e74' in position 2: encoding error

////

Full error:

Traceback (most recent call last): File "...\main.py", line 25, in <module> from phone_agent import PhoneAgent File "...\phone_agent\config\__init__.py", line 7, in <module> from phone_agent.config.prompts_zh import SYSTEM_PROMPT as SYSTEM_PROMPT_ZH File "...\phone_agent\config\prompts_zh.py", line 8, in <module> formatted_date = today.strftime("%Y年%m月%d日") + " " + weekday ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ UnicodeEncodeError: 'locale' codec can't encode character '\u5e74' in position 2: encoding error

Expected behavior / 期待表现

The application should start successfully regardless of the system's locale settings. The Chinese date format in the prompt should be generated correctly on all systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions