parent
8d8e9d54c8
commit
1fc85b87bd
|
@ -3168,8 +3168,8 @@ String String::word_wrap(int p_chars_per_line) const {
|
||||||
String String::percent_encode() const {
|
String String::percent_encode() const {
|
||||||
const CharString temp = utf8();
|
const CharString temp = utf8();
|
||||||
String res;
|
String res;
|
||||||
for (int i = 0; i < length(); ++i) {
|
for (int i = 0; i < temp.length(); ++i) {
|
||||||
CharType ord = temp[i];
|
char ord = temp[i];
|
||||||
if (ord == '.' || ord == '-' || ord == '_' || ord == '~' ||
|
if (ord == '.' || ord == '-' || ord == '_' || ord == '~' ||
|
||||||
(ord >= 'a' && ord <= 'z') ||
|
(ord >= 'a' && ord <= 'z') ||
|
||||||
(ord >= 'A' && ord <= 'Z') ||
|
(ord >= 'A' && ord <= 'Z') ||
|
||||||
|
@ -3178,9 +3178,9 @@ String String::percent_encode() const {
|
||||||
} else {
|
} else {
|
||||||
char h_Val[3];
|
char h_Val[3];
|
||||||
#if defined(__GNUC__) || defined(_MSC_VER)
|
#if defined(__GNUC__) || defined(_MSC_VER)
|
||||||
snprintf(h_Val, 3, "%.2X", ord);
|
snprintf(h_Val, 3, "%hhX", ord);
|
||||||
#else
|
#else
|
||||||
sprintf(h_Val, "%.2X", ord);
|
sprintf(h_Val, "%hhX", ord);
|
||||||
#endif
|
#endif
|
||||||
res += "%";
|
res += "%";
|
||||||
res += h_Val;
|
res += h_Val;
|
||||||
|
|
Loading…
Reference in New Issue