Skip to content

fixed: support utf-8 path xml-file #845

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

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -74,7 +74,6 @@ else()
include(cmake/conan_build.cmake)
endif()


#############################################################
# LIBRARY

@@ -187,6 +186,7 @@ target_compile_definitions(${BTCPP_LIBRARY} PUBLIC BTCPP_LIBRARY_VERSION="${CMAK
target_compile_features(${BTCPP_LIBRARY} PUBLIC cxx_std_17)

if(MSVC)
target_compile_options(${BTCPP_LIBRARY} PRIVATE "/source-charset:utf-8")
else()
target_compile_options(${BTCPP_LIBRARY} PRIVATE -Wall -Wextra)
endif()
13 changes: 12 additions & 1 deletion src/xml_parsing.cpp
Original file line number Diff line number Diff line change
@@ -19,6 +19,12 @@
#include <string>
#include <typeindex>

#if defined(_MSVC_LANG) && !defined(__clang__)
#define __bt_cplusplus (_MSC_VER == 1900 ? 201103L : _MSVC_LANG)
#else
#define __bt_cplusplus __cplusplus
#endif

#if defined(__linux) || defined(__linux__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wattributes"
@@ -254,7 +260,12 @@ void XMLParser::PImpl::loadDocImpl(XMLDocument* doc, bool add_includes)
break;
}

std::filesystem::path file_path(incl_node->Attribute("path"));
#if __bt_cplusplus >= 202002L
auto file_path(std::filesystem::path(incl_node->Attribute("path")));
#else
auto file_path(std::filesystem::u8path(incl_node->Attribute("path")));
#endif

const char* ros_pkg_relative_path = incl_node->Attribute("ros_pkg");

if(ros_pkg_relative_path)