From 96c4a5672239bd47849f3da49e46afeac8e22c8f Mon Sep 17 00:00:00 2001 From: Jgunishka <53265225+Jgunishka@users.noreply.github.com> Date: Wed, 21 Aug 2019 21:30:30 +0300 Subject: [PATCH] Add charset convertion --- src/org/emulinker/util/EmuLang.java | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/org/emulinker/util/EmuLang.java b/src/org/emulinker/util/EmuLang.java index 97fd345..6062b73 100644 --- a/src/org/emulinker/util/EmuLang.java +++ b/src/org/emulinker/util/EmuLang.java @@ -4,6 +4,7 @@ import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.io.UnsupportedEncodingException; import java.lang.reflect.*; import org.apache.commons.logging.Log; @@ -55,7 +56,15 @@ public class EmuLang { 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) { @@ -68,7 +77,15 @@ public class EmuLang { 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) {