Am 25.08.2014 21:50, schrieb "Ola Fosheim Grøstad"
<[email protected]>":
On Monday, 25 August 2014 at 19:38:05 UTC, Walter Bright wrote:
The adaptation is to take arbitrary byte input in an unknown encoding
and produce valid UTF.
I agree.
For a restful http service the encoding should be specified in the http
header and the input rejected if it isn't UTF compatible. For that use
scenario you only want validation, not conversion. However some
validation is free, like if you only accept numbers you could just turn
off parsing of strings in the template…
If files are read from storage then you can reread the file if it fails
validation on the first pass.
I wonder, in which use scenario it is that both of these conditions fail?
1. unspecified character-set and cannot assume UTF for JSON
3. unable to re-parse
BTW, JSON is *required* to be UTF encoded anyway as per RFC-7159, which
is another argument for just letting the lexer assume valid UTF.