MCPcopy Create free account
hub / github.com/colmap/colmap / PathToUtf8

Function PathToUtf8

src/colmap/sensor/bitmap.cc:72–75  ·  view source on GitHub ↗

Convert a filesystem path to a UTF-8 std::string. On Windows, path.string() returns a locale-dependent narrow string, which mangles non-ASCII characters before they reach OIIO. path.u8string() always yields UTF-8 bytes, but its return type changes from std::string in C++17 to std::u8string in C++20; the reinterpret_cast keeps this portable.

Source from the content-addressed store, hash-verified

70// UTF-8 bytes, but its return type changes from std::string in C++17 to
71// std::u8string in C++20; the reinterpret_cast keeps this portable.
72std::string PathToUtf8(const std::filesystem::path& path) {
73 const auto u8 = path.u8string();
74 return std::string(reinterpret_cast<const char*>(u8.data()), u8.size());
75}
76
77std::vector<uint8_t> ConvertColorSpace(const uint8_t* src_data,
78 int width,

Callers 2

ReadMethod · 0.85
WriteMethod · 0.85

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected