congo-cc / congo-parser-generator

The CongoCC Parser Generator, the Next Generation of JavaCC 21, which in turn was the next generation of JavaCC
https://discuss.congocc.org/
Other
36 stars 11 forks source link

use StandardCharsets #26

Closed stbischof closed 1 year ago

stbischof commented 1 year ago
StandardCharsets.UTF_8
StandardCharsets.UTF_16LE
StandardCharsets.UTF_16BE

https://github.com/congo-cc/congo-parser-generator/blob/08708399b324504961bb1a55fcee58f31e5a1d2c/src/templates/java/TokenSource.java.ftl#L485

revusky commented 1 year ago

Okay, that is reasonable. The strange thing is that, in that spot, we still have to get UTF-32BE and UTF-32LE via Charset.forName(). I'm not sure why those aren't "standard" charsets. They're probably always there in practice. If they aren't there, then Charset.forName will throw an exception, but we have no way of handling the exception other than just letting it bubble up really. In any case, I don't think that ever happens anyway.