As it currently stands, YangTextSchemaSource works on ByteSource, i.e. it does not make any guarantees about the actual character set being used. We pass whatever bytes we have to ANTLR, where we use a constructor which assumes UTF-8.
We can be more flexible: make YangTextSchemaSource as CharSource, exposing the character set in use the the various utility methods. This allows use to push the charset assumption up a layer to actual callers and interface ANTLR with plain java.io.Reader, i.e. without forcing everone to use UTF-8.
Since this impacts YANGTOOLS-1507, rename ImmediateYangTextSchemaSource to StringYangTextSchemaSource, making it more obvious.