bodewig 2003/04/24 02:11:39
Modified: . WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional ReplaceRegExp.java Log: Properly deal with multi-byte encodings by reusing existing code that does. PR: 19187 Revision Changes Path 1.404 +3 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.403 retrieving revision 1.404 diff -u -r1.403 -r1.404 --- WHATSNEW 23 Apr 2003 16:00:59 -0000 1.403 +++ WHATSNEW 24 Apr 2003 09:11:38 -0000 1.404 @@ -106,6 +106,9 @@ * build.sh install had a problem on cygwin (with REALANTHOME). Bugzilla Report 17257 +* <replaceregexp> didn't work for multi-byte encodings if byline was false. + Bugzilla Report 19187. + Other changes: -------------- * Six new Clearcase tasks added. 1.19 +1 -11 ant/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java Index: ReplaceRegExp.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- ReplaceRegExp.java 4 Apr 2003 13:51:11 -0000 1.18 +++ ReplaceRegExp.java 24 Apr 2003 09:11:38 -0000 1.19 @@ -416,17 +416,7 @@ pw.flush(); } else { - int flen = (int) f.length(); - char tmpBuf[] = new char[flen]; - int numread = 0; - int totread = 0; - - while (numread != -1 && totread < flen) { - numread = br.read(tmpBuf, totread, flen); - totread += numread; - } - - String buf = new String(tmpBuf); + String buf = fileUtils.readFully(br); String res = doReplace(regex, subs, buf, options);