[antlr-interest] Unicode input
Bart Kiers
bkiers at gmail.com
Tue Feb 8 14:21:43 PST 2011
Hi,
On Tue, Feb 8, 2011 at 11:18 PM, Alex Lujan <alex at apption.com> wrote:
> Im having an issue with parsing an input that contains unicode characters.
>
> This is the code Im using to test the parser (messageBytes is an array
> created by reading bytes from a binary file):
>
> private static void parseMessage(byte[] messageBytes) throws IOException{
>
> ByteArrayInputStream input = new ByteArrayInputStream(messageBytes);
> ANTLRInputStream in = new ANTLRInputStream(input);
> ...
You'll probably want to set the *encoding* of the input using:
ANTLRInputStream<http://www.antlr.org/api/Java/classorg_1_1antlr_1_1runtime_1_1_a_n_t_l_r_input_stream.html#cc37ee52e581d61a2efef0413ae3366f>
(InputStream input, String encoding)
Regards,
Bart.
More information about the antlr-interest
mailing list