Skip to content

Conversation

@zhujie2006
Copy link

##Problem##
The A2UI sample running in a Windows shell can get this, while using a different codec
image

##Solution##
Set the encoding parameter while opening the xxx_data.json file

@google-cla
Copy link

google-cla bot commented Dec 20, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@triceviola24-sys
Copy link

http://Graphic Web Consultant&GoogleLLC
http://vio-ado-7140-655444-78569265

@bckim9489
Copy link

Thanks for the fix - this resolves the Windows UnicodeDecodeError nicely 👍

I was able to reproduce the original issue on Windows 11 (Python + uv):
UnicodeDecodeError: 'cp949' codec can't decode ... when reading restaurant_data.json.

With this change (encoding="utf-8"), the sample agent starts successfully and the demo flow works end-to-end on Windows.

As a small, optional follow-up idea (non-blocking):
would you consider using pathlib for building the file path and reading the data?
It can slightly improve readability and keep the path handling fully platform-independent.

For example:

from pathlib import Path

file_path = Path(__file__).with_name("restaurant_data.json")
restaurant_data_str = file_path.read_text(encoding="utf-8")

Totally optional - the current fix already solves the problem well.
Just wanted to share this as a possible improvement.

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.

3 participants