diff -r b062d2232a90 javafx.lexer/src/org/netbeans/lib/javafx/lexer/JFXLexer.java --- a/javafx.lexer/src/org/netbeans/lib/javafx/lexer/JFXLexer.java Mon Feb 09 18:14:19 2009 +0100 +++ b/javafx.lexer/src/org/netbeans/lib/javafx/lexer/JFXLexer.java Mon Mar 09 11:43:08 2009 +0900 @@ -52,6 +52,7 @@ import java.io.IOException; import java.io.InputStream; +import java.util.ArrayList; import java.util.logging.Level; import java.util.logging.Logger; @@ -81,7 +82,7 @@ final LexerInputStream reader = new LexerInputStream(); reader.setLexerInput(lexerInput); - ANTLRReaderStream input = new ANTLRInputStream(reader); + ANTLRReaderStream input = new ANTLRInputStream(reader, "UTF-8"); lexer = new v4Lexer(input); final LexerState ls = (LexerState) info.state(); if (ls != null) { @@ -154,14 +155,43 @@ static class LexerInputStream extends InputStream { private LexerInput input; + private ArrayList si = new ArrayList(); public void setLexerInput(LexerInput input) { this.input = input; } public int read() throws IOException { - final int c = input.read(); - if (c == LexerInput.EOF) return -1; + int c = input.read(); + + if (c > 0xff) { + /* + * Create bytes from readed character for non-ascii + */ + char cc[] = {(char) c}; + String cs = new String(cc); + final byte[] result = cs.getBytes("UTF-8"); + + /* + * Add to array + */ + for (int i = 0; i < result.length; i++) { + si.add(result[i]); + } + } else if (c > 0) { + si.add((byte) c); + } + + /* + * if array is not empty, return 1st one + */ + if (si.size() > 0) { + c = si.get(0); + si.remove(0); + } else { + return -1; + } + return c; } }