Commits

Chris Nauroth committed 36550a5

correct handling of URL-encoded characters

Comments (0)

Files changed (2)

src/main/java/cc/plural/jsonij/StringImp.java

             }
         }
         outputStringBuilder.append('"');
-        return String.format(outputStringBuilder.toString());
+        return outputStringBuilder.toString();
     }
 }

src/test/java/cc/plural/jsonij/JSONStringTest.java

         new JSON.String(null);
         new JSON.String("Value 2");
         new JSON.String("this is a string with a tab \t character");
+        new JSON.String("this is a string with a %7BURL-encoded%7D character");
     }
     
     @Test
         Value value3 = new JSON.String("this is a string with a tab \t character");
         assertEquals(value3, new JSON.String("this is a string with a tab \t character"));
         
+        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
+        assertEquals(value4.toJSON(), "\"this is a string with a %7BURL-encoded%7D character\"");
+
         assertNotSame(value1, value2);
         assertNotSame(value2, value3);
+        assertNotSame(value3, value4);
         
         
         assertEquals(value1, "");
         assertEquals(value2, "Value 2");
         assertEquals(value3, "this is a string with a tab \t character");
+        assertEquals(value4, "this is a string with a %7BURL-encoded%7D character");
     }
     
     @Test
         assertEquals(value2.toJSON(), "\"Value 2\"");
         Value value3 = new JSON.String("this is a string with a tab \t character");
         assertEquals(value3.toJSON(), "\"this is a string with a tab \\t character\"");
+        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
+        assertEquals(value4.toJSON(), "\"this is a string with a %7BURL-encoded%7D character\"");
     }
     
     @Test
         assertEquals(value2.toString(), "Value 2");
         Value value3 = new JSON.String("this is a string with a tab \t character");
         assertEquals(value3.toString(), "this is a string with a tab \t character");
+        Value value4 = new JSON.String("this is a string with a %7BURL-encoded%7D character");
+        assertEquals(value4.toString(), "this is a string with a %7BURL-encoded%7D character");
     }
 }