-
Notifications
You must be signed in to change notification settings - Fork 12
Description
Describe the bug
Builder::add_ingredient fails with non-ascii characters in source_path on Windows if the current character encoding is not utf-8.
An C2paException exception will occur with message: "Failed to open file: "
There is a conversion to utf8 string called path_to_string(...) in open_file_binary(...) that causes this. We believe this conversion should be removed. Sending std::filesystem::path directly into the constructor of the stream would handle character encoding/conversion correctly.
Please see suggested fix on our fork:
https://github.com/contentauth/c2pa-c/compare/vNext...fwanderse:c2pa-c:fw-anderse/fix-utf8-convert-issue-in-open_file_binary?diff=split&w
To Reproduce
Use an ingredient filename like for example: image_name-using-øæå.jpg.
Attachments
Can add on request, but do not think it is needed to explain this issue.
Expected behavior
No error opening ingredient file.
Desktop (please complete the following information):
- Windows 10
Using vNext branch latest - Using Microsoft Visual C++. C++20.
- N/A
Additional context
Note: When opening the same file using the Reader a similar conversion of the file path is not applied and an error like this does not occur.