|
리소스로부터 텍스트를 읽어왔는데 아래와 같이 한글이 깨지네요. 어떻게 해야 할까요?
리소스 파일은 utf8입니다.
------------------------------------------
public loadResourceFromClassPath(String resourcePath) {
return ReflectionUtils.getCallingClass(0).getResourceAsStream(resourcePath);
}
public void someMethod() {
String text = loadResourceFromClassPath("/resource1.txt").eachLine {
line, lineNumber ->
if (lineNumber == 1) {
grinder.logger.debug("general:" + line);
// 깨지길래 인코딩을 해봤습니다.
generalKwds = new String(line.getBytes("UTF-8"), "UTF-8").split();
for ( int i = 0; i < generalKwds.length; i++) {
grinder.logger.debug("general token:" + generalKwds[i]);
}
}
};
}
----------------------------------
2013-11-25 17:43:59,069 INFO running "TestRunner.groovy" using GroovyScriptEngine running with groovy version: 2.0.6
2013-11-25 17:44:00,178 DEBUG general:����ㅼ�痢�議곕� ������곕���� ��� ��� 媛��嫄�諛�� �ы� 肄��
2013-11-25 17:44:00,186 DEBUG general token:����ㅼ�痢�議곕�
2013-11-25 17:44:00,186 DEBUG general token:������곕����
2013-11-25 17:44:00,186 DEBUG general token:���
2013-11-25 17:44:00,186 DEBUG general token:���
2013-11-25 17:44:00,186 DEBUG general token:媛��嫄�諛��
2013-11-25 17:44:00,186 DEBUG general token:�ы�
|