Skip to content

Commit 6151042

Browse files
committed
use 'C' locale for alnum check in urlencoder
1 parent 4e9ce9d commit 6151042

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/iceberg/util/url_encoder.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "iceberg/util/url_encoder.h"
2121

22+
#include <locale>
23+
2224
namespace iceberg {
2325

2426
namespace {
@@ -37,7 +39,8 @@ std::string UrlEncoder::Encode(std::string_view str_to_encode) {
3739
result.reserve(str_to_encode.size() * 3 /* Worst case: every char becomes %XX */);
3840

3941
for (unsigned char c : str_to_encode) {
40-
if (std::isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
42+
if (std::isalnum(c, std::locale::classic()) || c == '-' || c == '_' || c == '.' ||
43+
c == '~') {
4144
result += static_cast<char>(c);
4245
} else {
4346
result += '%';

src/iceberg/util/url_encoder.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <string_view>
2424

2525
#include "iceberg/iceberg_export.h"
26-
#include "iceberg/result.h"
2726

2827
/// \file iceberg/util/url_encoder.h
2928
/// \brief URL encoding and decoding.

0 commit comments

Comments
 (0)