From 64407ad2ff63e04db7476d48592bcd19f52814c2 Mon Sep 17 00:00:00 2001 From: Dawid Weiss Date: Thu, 5 Jul 2012 11:46:33 +0000 Subject: [PATCH] LUCENE-4194: just a taste of what I mean by encoding-sensitive. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1357565 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/lucene/benchmark/byTask/utils/Config.java | 3 ++- .../apache/lucene/benchmark/byTask/TestPerfTasksLogic.java | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java index 0d53a1aa003..88af670dfa2 100644 --- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/utils/Config.java @@ -80,7 +80,8 @@ public class Config { } // read props from string this.props = new Properties(); - props.load(new ByteArrayInputStream(sb.toString().getBytes())); + // props.load always assumes iso8859-1... + props.load(new ByteArrayInputStream(sb.toString().getBytes("ISO-8859-1"))); // make sure work dir is set properly if (props.get("work.dir") == null) { diff --git a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java index ac1b7589567..740cd13716a 100755 --- a/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java +++ b/lucene/benchmark/src/test/org/apache/lucene/benchmark/byTask/TestPerfTasksLogic.java @@ -19,7 +19,8 @@ package org.apache.lucene.benchmark.byTask; import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; +import java.io.FileInputStream; +import java.io.InputStreamReader; import java.io.StringReader; import java.text.Collator; import java.util.List; @@ -398,7 +399,9 @@ public class TestPerfTasksLogic extends BenchmarkTestCase { // Run algo Benchmark benchmark = execBenchmark(algLines1); - BufferedReader r = new BufferedReader(new FileReader(lineFile)); + BufferedReader r = new BufferedReader( + new InputStreamReader( + new FileInputStream(lineFile), "UTF-8")); int numLines = 0; String line; while((line = r.readLine()) != null) {