Skip to content

Fix unicode path handling in codegen#1312

Open
LPuehringerStudent wants to merge 1 commit intogeode-sdk:mainfrom
LPuehringerStudent:main
Open

Fix unicode path handling in codegen#1312
LPuehringerStudent wants to merge 1 commit intogeode-sdk:mainfrom
LPuehringerStudent:main

Conversation

@LPuehringerStudent
Copy link

This PR fixes #126 - Unicode path handling in codegen.

Problem

On Windows, std::ifstream and std::ofstream don't handle Unicode paths correctly when constructed from std::filesystem::path. They convert to narrow strings using the system code page, which causes failures when usernames or paths contain non-ASCII characters (e.g., ñ, é, 中).

Solution

Added cross-platform helper functions openInputFile() and openOutputFile() in Shared.hpp that:

  • On Windows: use path.wstring() to properly handle Unicode characters via the wide-character stream constructors
  • On other platforms: use the standard std::filesystem::path constructor (no change needed)

Changes

  • codegen/src/Shared.hpp: Added helper functions and updated writeFile() to use them
  • codegen/src/Main.cpp: Updated version file reading to use the new helper

Testing

This fix allows codegen to work correctly when the bindings repository or SDK is located in paths containing Unicode characters, such as usernames with special characters.

On Windows, std::ifstream and std::ofstream don't handle Unicode paths
correctly when constructed from std::filesystem::path because they convert
to narrow strings using the system code page.

This commit adds cross-platform helper functions openInputFile() and
openOutputFile() that:
- On Windows: use path.wstring() to properly handle Unicode characters
- On other platforms: use the standard path constructor

Fixes geode-sdk#126
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.

Codegen fails on unicode paths

1 participant