[clangd] Mark colon as a safe character when percent-encoding.

Summary: Also change output of percent-encoding to use upper-case letters.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits

Differential Revision: https://reviews.llvm.org/D53016

git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@344033 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clangd/URI.cpp b/clangd/URI.cpp
index 0eab8f5..7e75296 100644
--- a/clangd/URI.cpp
+++ b/clangd/URI.cpp
@@ -91,6 +91,8 @@
   case '.':
   case '~':
   case '/': // '/' is only reserved when parsing.
+  // ':' is only reserved for relative URI paths, which clangd doesn't produce.
+  case ':':
     return false;
   }
   return true;
@@ -105,7 +107,7 @@
   llvm::raw_string_ostream OS(Result);
   for (unsigned char C : Content)
     if (shouldEscape(C))
-      OS << '%' << llvm::format_hex_no_prefix(C, 2);
+      OS << '%' << llvm::format_hex_no_prefix(C, 2, /*Upper = */true);
     else
       OS << C;