diff --git a/src/main.cpp b/src/main.cpp index 036be46..bc82761 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -37,6 +38,9 @@ int main(int argc, char *argv[]) using std::cerr; using std::cout; + // locale_generator("").name.c_str() returns "*" instead of "". That's why + // the global C locale isn't changed. So we have to set it additionally. + std::setlocale(LC_ALL, ""); boost::locale::generator locale_generator; locale_generator.add_messages_path("translations"); locale_generator.add_messages_path("/usr/share/locale"); diff --git a/src/zip.cpp b/src/zip.cpp index 17134c2..3fe0d86 100644 --- a/src/zip.cpp +++ b/src/zip.cpp @@ -50,7 +50,7 @@ std::vector list(const fs::path &filepath) std::vector toc; while (archive_read_next_header(zipfile, &entry) == ARCHIVE_OK) { - toc.emplace_back(archive_entry_pathname(entry)); + toc.emplace_back(archive_entry_pathname_utf8(entry)); archive_read_data_skip(zipfile); } diff --git a/tests/test_zip_list.cpp b/tests/test_zip_list.cpp index 9c8af06..e7f76ba 100644 --- a/tests/test_zip_list.cpp +++ b/tests/test_zip_list.cpp @@ -3,12 +3,14 @@ #include +#include #include #include #include SCENARIO("epubgrep::zip::list() doesn't fail and returns the right file list") { + std::setlocale(LC_CTYPE, ""); // Needed for utf-8 support in libarchive. bool exception{false}; std::vector filelist;