From c3a903876567116c619bad264e20e31851d70c28 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Thu, 24 Apr 2003 09:11:38 +0000 Subject: [PATCH] Properly deal with multi-byte encodings by reusing existing code that does. PR: 19187 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274509 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../tools/ant/taskdefs/optional/ReplaceRegExp.java | 12 +----------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 007afeb53..fefaf3504 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -106,6 +106,9 @@ Fixed bugs: * build.sh install had a problem on cygwin (with REALANTHOME). Bugzilla Report 17257 +* didn't work for multi-byte encodings if byline was false. + Bugzilla Report 19187. + Other changes: -------------- * Six new Clearcase tasks added. diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java index 0bf3c4842..cd7895a6d 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ReplaceRegExp.java @@ -416,17 +416,7 @@ public class ReplaceRegExp extends Task { 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);