From 5dc5dbbbb464bf4930380313e3e64bd23b7eb5c5 Mon Sep 17 00:00:00 2001 From: Michael Lotz Date: Sun, 1 Jul 2012 20:30:35 +0200 Subject: [PATCH] Allow more chars to be sent unencoded and encode space as '+'. While this produces not strictly valid query strings, it reduces the encoding overhead significantly. --- src/add-ons/kernel/debugger/qrencode/module.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/debugger/qrencode/module.cpp b/src/add-ons/kernel/debugger/qrencode/module.cpp index 54a52c53b2..b2f215ddce 100644 --- a/src/add-ons/kernel/debugger/qrencode/module.cpp +++ b/src/add-ons/kernel/debugger/qrencode/module.cpp @@ -103,9 +103,21 @@ encode_url(const char* query, const char* data, int encodeLength, || (character >= 'A' && character <= 'Z') || (character >= '0' && character <= '9') || character == '.' || character == '-' || character == '_' - || character == '~') { + || character == '~' + // These aren't strictly valid, but seem to work. + || character == '/' || character == '(' || character == ')' + || character == '=' || character == '^' || character == '?' + || character == '|' || character == '*' || character == '@' + || character == ';' || character == ':' || character == ',' + || character == '{' || character == '}' || character == '[' + || character == ']' || character == '<' || character == '>' + || character == '!' || character == '\\') { sEncodeBuffer[position++] = character; sEncodeBuffer[position] = 0; + } else if (character == ' ') { + // Encode spaces as '+' as that's shorter than %20. + sEncodeBuffer[position++] = '+'; + sEncodeBuffer[position] = 0; } else { // Encode to a %xx escape. if (encodeLength - position < 3) {