public void setParserSupport(ParserSupport parserSupport) {
this.parserSupport = parserSupport;
}
private void setEncoding(ByteList name) {
Encoding newEncoding = parserSupport.getConfiguration().getEncodingService().loadEncoding(name);
if (newEncoding == null) {
throw new SyntaxException(PID.UNKNOWN_ENCODING, getPosition(),
null, "unknown encoding name: " + name.toString());
}
if (!newEncoding.isAsciiCompatible()) {
throw new SyntaxException(PID.NOT_ASCII_COMPATIBLE, getPosition(),
null, name.toString() + " is not ASCII compatible");
}
setEncoding(newEncoding);