Skip to content

Conversation

@zel1b08a
Copy link

According to #4271.

std::filesystem::path::string method uses system-dependent native format. String type is always UTF8 format, by the json docs. So we force encoding to be UTF8.

@zel1b08a zel1b08a requested a review from nlohmann as a code owner November 19, 2024 10:31
@github-actions github-actions bot added the S label Nov 19, 2024
@github-actions
Copy link

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @zel1b08a
Please read and follow the Contribution Guidelines.

@nlohmann
Copy link
Owner

Please run make amalgamate with Astyle (http://astyle.sourceforge.net) 3.1 installed.

inline void to_json(BasicJsonType& j, const std_fs::path& p)
{
j = p.string();
j = p.u8string();
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that from C++20, u8string will return std::u8string instead of std::string - I am not sure if this assignment works in this case.

Copy link
Author

@zel1b08a zel1b08a Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the copy with reinterpret_cast to char* there only..)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw a remark on cppreference.com

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean the u8string to string conversion here in that issue

@nlohmann
Copy link
Owner

The exception could come from the conversion of std::u8string to JSON. As std::u8string is not supported, the string is treated like a sequence of bytes and converted to an array.

@coveralls
Copy link

coveralls commented Dec 7, 2024

Coverage Status

coverage: 99.649%. remained the same
when pulling c859d64 on zel1b08a:patch-1
into 9f60e85 on nlohmann:develop.

@github-actions
Copy link

github-actions bot commented Dec 7, 2024

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @zel1b08a
Please read and follow the Contribution Guidelines.

@github-actions
Copy link

github-actions bot commented Dec 9, 2024

🔴 Amalgamation check failed! 🔴

The source code has not been amalgamated. @zel1b08a
Please read and follow the Contribution Guidelines.

@github-actions
Copy link

This pull request has been marked as stale because it has had no activity for 30 days. While we won’t close it automatically, we encourage you to update or comment if it is still relevant. Keeping pull requests active and up-to-date helps us review and merge changes more efficiently. Thank you for your contributions!

@github-actions github-actions bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Jan 18, 2025
@risa2000
Copy link
Contributor

I believe this has been resolved by #4631 and could be closed.

@nlohmann nlohmann closed this Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants