Skip to content

Fix/csv utf8 bom Improve CSV UTF-8 compatibility with Excel - #497

Open
Space-FuCheng wants to merge 2 commits into
Razeeman:devfrom
Space-FuCheng:fix/csv-utf8-bom
Open

Space-FuCheng wants to merge 2 commits into
Razeeman:devfrom
Space-FuCheng:fix/csv-utf8-bom

Conversation

@Space-FuCheng

Copy link
Copy Markdown

Summary

Prepend a UTF-8 BOM to exported CSV files so spreadsheet applications such as Microsoft Excel can reliably detect UTF-8 encoding when opening CSV files directly.

Why

Without a BOM, Excel on Windows may interpret UTF-8 CSV files using a local legacy encoding, which can cause non-ASCII text such as Chinese, Japanese, accented characters, and emoji to display incorrectly.

Change

  • Write the UTF-8 BOM bytes (EF BB BF) before the CSV header.
  • Leave the CSV data format unchanged.

Testing

  • Built the playDebug APK successfully using the repository's Build workflow.
  • Installed and ran the debug build.
  • Exported CSV data containing Chinese text.
  • Verified the exported file starts with EF BB BF.
  • Verified the CSV opens directly in Microsoft Excel on Windows with Chinese text displayed correctly.

Note: some strict CSV consumers that do not handle UTF-8 BOMs may expose it as part of the first header field, though most modern CSV and spreadsheet tools handle it correctly.

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