Add charset convertion

This commit is contained in:
Jgunishka 2019-08-21 21:30:30 +03:00
parent 22464b8713
commit 96c4a56722

View File

@ -4,6 +4,7 @@ import java.text.MessageFormat;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; import java.util.ResourceBundle;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.*; import java.lang.reflect.*;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -55,7 +56,15 @@ public class EmuLang
{ {
try try
{ {
return RESOURCE_BUNDLE.getString(key); String str = RESOURCE_BUNDLE.getString(key);
try {
byte[] buff = str.getBytes("ISO-8859-1");
str = new String(buff, System.getProperty("emulinker.charset"));
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return str;
} }
catch (MissingResourceException e) catch (MissingResourceException e)
{ {
@ -68,7 +77,15 @@ public class EmuLang
{ {
try try
{ {
return (new MessageFormat(RESOURCE_BUNDLE.getString(key))).format(messageArgs); String str = RESOURCE_BUNDLE.getString(key);
try {
byte[] buff = str.getBytes("ISO-8859-1");
str = new String(buff, System.getProperty("emulinker.charset"));
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return (new MessageFormat(str)).format(messageArgs);
} }
catch (MissingResourceException e) catch (MissingResourceException e)
{ {