[antlr-interest] misunderstanding channel HIDDEN

David-Sarah Hopwood david-sarah at jacaranda.org
Thu Aug 27 15:02:52 PDT 2009


David-Sarah Hopwood wrote:
> Ian Eyberg wrote:
>>     if ( (contents[0] == (byte)0xFF) && (contents[1] == (byte)0xFE) ) {
> 
> You probably want to accept little-endian UTF-16 (as sometimes produced
> by Windows systems) here, given that it's very easy to do:

Correction: you probably want to also accept big-endian UTF-16. Your
code above was detecting only little-endian.

>       if ( (contents[0] == (byte)0xFF && contents[1] == (byte)0xFE) ||
>            (contents[0] == (byte)0xFE && contents[1] == (byte)0xFF) ) {

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com



More information about the antlr-interest mailing list