Commit d7557c42 by Lee Jaebin

#34085 【SATO android 1.0.0】オーサリングツールで作成した資料で文字化けが発生することがある

parent 824568a6
package jp.agentec.adf.util; package jp.agentec.adf.util;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileFilter; import java.io.FileFilter;
import java.io.FileInputStream; import java.io.FileInputStream;
...@@ -855,13 +856,32 @@ public class FileUtil { ...@@ -855,13 +856,32 @@ public class FileUtil {
return null; // TODO: later 暫定処置 とりあえずこのまま return null; // TODO: later 暫定処置 とりあえずこのまま
// throw new FileNotFoundException(path); // throw new FileNotFoundException(path);
} }
return readTextFile(new FileInputStream(file)); return readTextFile(new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")));
}
public static String readTextFile(BufferedReader bufferedReader) throws IOException {
StringBuffer text = new StringBuffer();
try {
String readStr;
while ((readStr = bufferedReader.readLine()) != null) {
text.append(readStr);
}
return text.toString();
}
finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch (Exception e2) {
}
}
}
} }
public static String readTextFile(InputStream is) throws IOException { public static String readTextFile(InputStream is) throws IOException {
StringBuffer text = new StringBuffer(); StringBuffer text = new StringBuffer();
try { try {
int bufferSize = 2048; int bufferSize = 2048;
int readSize; int readSize;
byte[] buffer = new byte[bufferSize]; byte[] buffer = new byte[bufferSize];
while ((readSize = is.read(buffer, 0, buffer.length)) > 0) { while ((readSize = is.read(buffer, 0, buffer.length)) > 0) {
......
...@@ -205,7 +205,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -205,7 +205,7 @@ public class OperationListActivity extends ABVUIActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.ac_operation_list); setContentView(R.layout.ac_operation_list);
mListHelper = new OperationListHelper(this);; mListHelper = new OperationListHelper(this);
mViewModeButton = (ImageButton) findViewById(R.id.btn_view_mode); mViewModeButton = (ImageButton) findViewById(R.id.btn_view_mode);
mSearchButton = (ImageButton) findViewById(R.id.btn_search); mSearchButton = (ImageButton) findViewById(R.id.btn_search);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment