Fix feature names with special characters. (#9923)

This commit is contained in:
Jiaming Yuan
2023-12-28 22:45:13 +08:00
committed by GitHub
parent a197899161
commit a7226c0222
4 changed files with 88 additions and 68 deletions

View File

@@ -66,8 +66,20 @@ inline std::vector<std::string> Split(const std::string& s, char delim) {
return ret;
}
/**
* @brief Add escapes for a UTF-8 string.
*/
void EscapeU8(std::string const &string, std::string *p_buffer);
/**
* @brief Add escapes for a UTF-8 string with newly created buffer as return.
*/
inline std::string EscapeU8(std::string const &str) {
std::string buffer;
EscapeU8(str, &buffer);
return buffer;
}
template <typename T>
XGBOOST_DEVICE T Max(T a, T b) {
return a < b ? b : a;