Example:
(clojure.tools.reader/read-string "\"\\340\"")
Throws an exception:
ExceptionInfo Octal escape sequence must be in range [0, 377]. clojure.core/ex-info (core.clj:4725)
The octal number 0340 is less than the octal number 0377. The expected result is:
"à"
Thanks, this needs to be fixed for edn and the cljs version too, could you update the patch?
Here is an updated patch. I have moved tests to common_tests.clj so that they cover both clojure.tools.reader and clojure.tools.reader.edn. I added tests for cljs. I changed the constant 0337 to 0377 where applicable.
To my surprise, the tests that I added for cljs do not fail on the old code or the new code. I believe this is because (int \à) evaluates to 0 in cljs. See cljs.tools.reader/escape-char. This could be user error on my part--I have not done any Clojurescript before this and I had to do some unfamiliar environment setup.
If my thinking here is correct, then (cljs.tools.reader/read-string "\"\\400\"") and (cljs.tools.reader.edn/read-string "\"\\400\"") will evaluate to "Ā" when an error is expected. Can you confirm?
Thank you for your time on this!
can you please sign the CA? See https://clojure.org/community/contributing I can't take your patch until you do
Thank you for pointing that out; I have now done so.
Merged, thanks.
I'll take a look at the cljs case separately as lack of validation is not as serious as not accepting valid code