diff --git a/.github/workflows/windows-native.yml b/.github/workflows/windows-native.yml index 70d55b2d..fb559f73 100644 --- a/.github/workflows/windows-native.yml +++ b/.github/workflows/windows-native.yml @@ -46,6 +46,7 @@ jobs: ${{ runner.os }}-maven- - name: Build with Maven (neutrino-proxy-server) run: | + set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8" mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress cd neutrino-proxy-server mvn clean native:compile -P native --file pom.xml --no-transfer-progress @@ -58,6 +59,7 @@ jobs: filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref_name }}.zip - name: Build with Maven (neutrino-proxy-client) run: | + set MAVEN_OPTS="-Duser.language=UTF-8 -Dfile.encoding=UTF-8" cd neutrino-proxy-client mvn clean package --file pom.xml --no-transfer-progress mvn clean native:compile -P native --file pom.xml --no-transfer-progress diff --git a/neutrino-proxy-core/src/main/java/org/dromara/neutrinoproxy/core/util/FileUtil.java b/neutrino-proxy-core/src/main/java/org/dromara/neutrinoproxy/core/util/FileUtil.java index b7214dd8..1b3e353e 100644 --- a/neutrino-proxy-core/src/main/java/org/dromara/neutrinoproxy/core/util/FileUtil.java +++ b/neutrino-proxy-core/src/main/java/org/dromara/neutrinoproxy/core/util/FileUtil.java @@ -5,6 +5,7 @@ import org.dromara.neutrinoproxy.core.base.MetaDataConstant; import org.apache.commons.lang3.StringUtils; import java.io.*; +import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.List; import java.util.jar.JarEntry; @@ -56,7 +57,7 @@ public class FileUtil { * @throws IOException */ public static String readContentAsString(String path) { - try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path)))){ + try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path), StandardCharsets.UTF_8))){ return br.lines().collect(Collectors.joining("\n")); } catch (Exception e) { return null; @@ -70,7 +71,7 @@ public class FileUtil { * @throws IOException */ public static String readContentAsString(InputStream in) { - try (BufferedReader br = new BufferedReader(new InputStreamReader(in))){ + try (BufferedReader br = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8))){ return br.lines().collect(Collectors.joining("\n")); } catch (Exception e) { return null; @@ -84,7 +85,7 @@ public class FileUtil { * @throws IOException */ public static List readContentAsStringList(String path) { - try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path)))){ + try (BufferedReader br = new BufferedReader(new InputStreamReader(getInputStream(path), StandardCharsets.UTF_8))){ return br.lines().collect(Collectors.toList()); } catch (Exception e) { return null;