Unverified Commit 5a6f768b authored by Licho's avatar Licho Committed by GitHub

Fix encode (#2283)

* feat: fix encode * Spotless Apply * feat: fix encode * feat: fix fix encode * Spotless Apply --------- Co-authored-by: 's avatarleechor <leechor@users.noreply.github.com>
parent 815b8dfc
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.dinky.utils;
public final class AppConstant {
public static final String JDK_VERSION = System.getProperty("java.specification.version");
public static final boolean JDK_ABOVE_1_8 = JDK_VERSION.compareTo("1.8") > 0;
private AppConstant() {}
}
......@@ -19,6 +19,9 @@
package org.dinky.utils;
import static org.dinky.utils.AppConstant.JDK_ABOVE_1_8;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.Locale;
......@@ -51,7 +54,9 @@ public final class I18n {
public static String getMessage(String key) {
bundle = ResourceBundle.getBundle(MESSAGES_BASE);
String message = bundle.getString(key);
// message = new String(message.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
if (!JDK_ABOVE_1_8) {
message = new String(message.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
}
return message;
}
......
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