Hi,
I'm trying to "unparse" an RQL expression - restore it to its textual form. To this end, I'm constructing a Query object seeded with the raw result of the parsing:
In the nominal case of no special chars, it works just fine - however, as presented above, an error will be thrown:
/home/thewanderer/Devel/Node/rql-test/node_modules/rql/parser.js:218
string = decodeURIComponent(string);
^
URIError: URI malformed
at decodeURIComponent (native)
at Object.exports.converters.auto (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/parser.js:218:13)
at Object.exports.encodeValue (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/query.js:82:43)
at queryToString (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/query.js:66:18)
at serializeArgs (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/query.js:43:16)
at queryToString (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/query.js:62:7)
at serializeArgs (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/query.js:43:16)
at Query.toString (/home/thewanderer/Devel/Node/rql-test/node_modules/rql/query.js:50:3)
at Object.<anonymous> (/home/thewanderer/Devel/Node/rql-test/rubbish.js:4:31)
This is probably because the Query object takes args verbatim and, during stringification, checks whether the "converted" form is the same as the input before deciding whether to apply a type prefix (turns something into string:something) . However, this uses the parser's converter, which, instead of encoding the contents, decodes it - the converter is one-way only. I consider this a logic bug.
Hi, I'm trying to "unparse" an RQL expression - restore it to its textual form. To this end, I'm constructing a Query object seeded with the raw result of the parsing:
In the nominal case of no special chars, it works just fine - however, as presented above, an error will be thrown:
This is probably because the Query object takes args verbatim and, during stringification, checks whether the "converted" form is the same as the input before deciding whether to apply a type prefix (turns
something
intostring:something
) . However, this uses the parser's converter, which, instead of encoding the contents, decodes it - the converter is one-way only. I consider this a logic bug.