From: <pj...@us...> - 2009-04-12 00:21:57
|
Revision: 6221 http://jython.svn.sourceforge.net/jython/?rev=6221&view=rev Author: pjenvey Date: 2009-04-12 00:21:44 +0000 (Sun, 12 Apr 2009) Log Message: ----------- restore the original encoding of SyntaxError text Modified Paths: -------------- trunk/jython/src/org/python/core/ParserFacade.java Modified: trunk/jython/src/org/python/core/ParserFacade.java =================================================================== --- trunk/jython/src/org/python/core/ParserFacade.java 2009-04-11 21:27:36 UTC (rev 6220) +++ trunk/jython/src/org/python/core/ParserFacade.java 2009-04-12 00:21:44 UTC (rev 6221) @@ -44,7 +44,7 @@ private ParserFacade() {} - private static String getLine(BufferedReader reader, int line) { + private static String getLine(ExpectedEncodingBufferedReader reader, int line) { if (reader == null) { return ""; } @@ -53,7 +53,14 @@ for (int i = 0; i < line; i++) { text = reader.readLine(); } - return text == null ? text : text + "\n"; + if (text == null) { + return text; + } + if (reader.encoding != null) { + // restore the original encoding + text = new PyUnicode(text).encode(reader.encoding); + } + return text + "\n"; } catch (IOException ioe) { } return text; @@ -80,7 +87,7 @@ line = node.getLine(); col = node.getCharPositionInLine(); } - String text=getLine(reader, line); + String text= getLine(reader, line); String msg = e.getMessage(); if (e.getType() == Py.IndentationError) { return new PyIndentationError(msg, line, col, text, filename); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |