Mercurial > hg > truffle
changeset 22098:0556c0056d71
read files in UTF-8 encoding
author | Christian Wirth <christian.wirth@oracle.com> |
---|---|
date | Wed, 19 Aug 2015 15:20:43 +0200 |
parents | c6966c8ea83c |
children | 049e6eeaf80a |
files | truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java Tue Aug 18 15:14:19 2015 +0200 +++ b/truffle/com.oracle.truffle.api/src/com/oracle/truffle/api/source/Source.java Wed Aug 19 15:20:43 2015 +0200 @@ -789,7 +789,7 @@ return code; } try { - return read(new FileReader(file)); + return read(new InputStreamReader(new FileInputStream(file), "UTF-8")); } catch (IOException e) { } return null; @@ -811,10 +811,12 @@ return new StringReader(code); } try { - return new FileReader(file); + return new InputStreamReader(new FileInputStream(file), "UTF-8"); } catch (FileNotFoundException e) { throw new RuntimeException("Can't find file " + path, e); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException("Unsupported encoding in file " + path, e); } }