mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-17 10:59:39 +00:00
Add tests for Unicode path component decoding in decode_path_component function
This commit is contained in:
1 parent
83e98a28dd
commit
43a54a3e3d
2 files changed
+15
-1
No files matched your search
@@ -9292,7 +9292,8 @@ inline std::string decode_path_component(const std::string &component) {
|
||||
// Unicode %uXXXX encoding
|
||||
auto val = 0;
|
||||
if (detail::from_hex_to_i(component, i + 2, 4, val)) {
|
||||
// 4 digits Unicode codes
|
||||
// 4 digits Unicode codes: val is 0x0000-0xFFFF (from 4 hex digits),
|
||||
// so to_utf8 writes at most 3 bytes. buff[4] is safe.
|
||||
char buff[4];
|
||||
size_t len = detail::to_utf8(val, buff);
|
||||
if (len > 0) { result.append(buff, len); }
|
||||
|
||||
Reference in new issue
Block a user