Skip to content

Conversation

@Mag1cFall
Copy link

Problem

The sample agents (restaurant_finder and contact_lookup) fail on Windows with the following error when reading JSON data files:

UnicodeDecodeError: 'gbk' codec can't decode byte 0x86 in position 216: illegal multibyte sequence

Cause

Python's open() function uses the system default encoding, which is GBK/BIG5 on Chinese Windows systems (and other non-UTF-8 locales). The JSON data files are UTF-8 encoded, causing the decode error.

Fix

Explicitly specify encoding='utf-8' when opening JSON files:

# Before
with open(file_path) as f:

# After
with open(file_path, encoding='utf-8') as f:

Testing

  • Demo runs successfully on Windows 11 after fix
  • No impact on Linux/macOS (UTF-8 is the default)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant