[PATCH] D43009: [clangd] Do not precent-encode numbers in URI.

Eric Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 7 02:26:06 PST 2018


ioeric created this revision.
ioeric added a reviewer: ilya-biryukov.
Herald added subscribers: cfe-commits, jkorous-apple, klimek.

Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D43009

Files:
  clangd/URI.cpp
  unittests/clangd/URITests.cpp


Index: unittests/clangd/URITests.cpp
===================================================================
--- unittests/clangd/URITests.cpp
+++ unittests/clangd/URITests.cpp
@@ -72,6 +72,7 @@
 TEST(PercentEncodingTest, Encode) {
   EXPECT_EQ(URI("x", /*Authority=*/"", "a/b/c").toString(), "x:a/b/c");
   EXPECT_EQ(URI("x", /*Authority=*/"", "a!b;c~").toString(), "x:a%21b%3bc~");
+  EXPECT_EQ(URI("x", /*Authority=*/"", "a123b").toString(), "x:a123b");
 }
 
 TEST(PercentEncodingTest, Decode) {
Index: clangd/URI.cpp
===================================================================
--- clangd/URI.cpp
+++ clangd/URI.cpp
@@ -79,7 +79,8 @@
 
 bool shouldEscape(unsigned char C) {
   // Unreserved characters.
-  if ((C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z'))
+  if ((C >= 'a' && C <= 'z') || (C >= 'A' && C <= 'Z') ||
+      (C >= '0' && C <= '9'))
     return false;
   switch (C) {
   case '-':


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43009.133178.patch
Type: text/x-patch
Size: 905 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180207/13bbb295/attachment.bin>


More information about the cfe-commits mailing list