crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
19.37k stars 2.68k forks source link

[BUG]UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 102: illegal multibyte sequence #1270

Open Jontyshaw opened 3 weeks ago

Jontyshaw commented 3 weeks ago

Description

When loading a variable from the yaml environment, the crewai library tries to load it in gbk encoding as soon as Chinese is present in it, but my yaml file is utf-8. You want to add a measure to detect file encoding when loading yaml files

Steps to Reproduce

  1. edit agent.yaml or task.yaml
  2. Write a lot of Chinese into the above two yaml files
  3. crewai run

Expected behavior

When loading yaml files, it automatically detects whether the file encoding is gbk or utf-8 or something else, and loads the file in this encoding format because it involves the definition of agents and the definition of tasks, and people in many other countries may use different encodings

Screenshots/Code snippets

image

Operating System

Windows 11

Python Version

3.12

crewAI Version

0.51.0

crewAI Tools Version

0.51.0

Virtual Environment

Poetry

Evidence

` crewai run C:\Users\jonty\AppData\Local\pypoetry\Cache\virtualenvs\crew-agent-OgCTPeQm-py3.12\Lib\site-packages\pydantic_internal_config.py:341: UserWarning: Valid config keys have changed in V2:

`

Possible Solution

When loading yaml files, it automatically detects whether the file encoding is gbk or utf-8 or something else, and loads the file in this encoding format because it involves the definition of agents and the definition of tasks, and people in many other countries may use different encodings

Additional context

no

kustcl commented 5 days ago

hello,have your questions has finished?,I also meet the same question,can you help me

guojingfeng1994 commented 4 days ago

When I use custom i18n json files, the json files also have this problem when loading

Jontyshaw commented 4 days ago

No, it hasn't been resolved yet. Currently, it is executed by converting the yaml file to GBK format, or using it entirely in English.