Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use Scene::saveToFile() with UTF-8-based string data on Windows #60

Open
ParadoxDaKo opened this issue Mar 18, 2022 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@ParadoxDaKo
Copy link

ParadoxDaKo commented Mar 18, 2022

Ramses Version: 27.0.115

For file paths, we are using UTF-8-based strings to support non-ASCII data such as Umlauts or Chinese letters.

Scene::saveToFile() accepts a const char* fileName and essentially passes it to fopen without change/encoding.

A simple const char* literal containing umlauts contains different data as a UTF-8 string with the same umlauts that gets its data passed into a const char* - which fopen doesn't seem to handle properly on Windows systems.

Here is a GTest that elucidates the problem:

TEST(ramses, saveToFile_withUmlauts) {
    ramses::RamsesFramework ramsesFramework;
    ramses::RamsesClient& client = *ramsesFramework.createClient("example client");
    ramses::Scene* scene = client.createScene(ramses::sceneId_t(123u), ramses::SceneConfig(), "export scene");

    std::filesystem::path path("saveToFile_äöü.ramses");	
    auto status = scene->saveToFile(path.generic_u8string().c_str(), false);

    ASSERT_EQ(status, 0);
}

In this test case, Ramses would try and save a file with the filename saveToFile_äöü.ramses.

PS: Even const char* literals with Chinese letters don't work with Scene::saveToFile().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants