         let VARCHAR = ClassVariable.VARCHAR
 
         // Pct-encoded isn't taken into account
-        func appendLiteralCharacter(character: Character, toString: String) -> String {
+        func encodeLiteralCharacter(character: Character) -> String {
             if find(RESERVED, character) || find(UNRESERVED, character) {
-                var str = toString + character
-                return str
+                return String(character)
             }
 
             var str = CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault,

                            pctEncoded += c
                        } else {
                            syntaxErrors += (URITemplateError.MalformedPctEncodedInLiteral, index)
                            result = appendLiteralString(pctEncoded, result)
                            result = appendLiteralCharacter(c, result)
                            state = .ScanningLiteral
                            pctEncoded = ""
                        }

                                        break;
                                    } else if modifier == ":" {
                                        if find(DIGIT, j) {
                                            prefixLength = prefixLength * 10 + Int(String(j).bridgeToObjectiveC().intValue)
                                            if prefixLength >= 1000 {
                                                eError = .MalformedVarSpec
                                                break;
