From 07d5c9f5e4ec1c8d1d6f49be017d64d55cd8a708 Mon Sep 17 00:00:00 2001 From: songyinyin Date: Thu, 26 Oct 2023 23:11:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=BF=9C=E7=A8=8B=E7=BC=96?= =?UTF-8?q?=E8=AF=91windows=E4=B9=B1=E7=A0=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/windows-native.yml | 2 ++ .../java/org/dromara/neutrinoproxy/core/util/FileUtil.java | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) 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;