[antlr-interest] Unicode input

Alex Lujan alex at apption.com
Wed Feb 9 06:35:31 PST 2011


Hi Bart,

Thanks for the suggestion, but Ive tried setting the encoding to UTF8 with
no success.

Any other ideas?

On Tue, Feb 8, 2011 at 5:21 PM, Bart Kiers <bkiers at gmail.com> wrote:

> 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.
>



-- 
Alejandro Lujan
Apption Software
(613) 725 62 68 x625


More information about the antlr-interest mailing list