Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package com.alibaba.cloud.nacos.parser;

import java.nio.charset.StandardCharsets;
import java.io.IOException;
import java.util.Arrays;
import java.util.Collections;
Expand All @@ -30,6 +31,7 @@
import org.springframework.boot.env.OriginTrackedMapPropertySource;
import org.springframework.boot.env.PropertiesPropertySourceLoader;
import org.springframework.boot.env.PropertySourceLoader;
import org.springframework.boot.env.YamlPropertySourceLoader;
import org.springframework.core.env.EnumerablePropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.SpringFactoriesLoader;
Expand Down Expand Up @@ -83,6 +85,12 @@ public List<PropertySource<?>> parseNacosData(String configName, String configVa
NacosConfigUtils.selectiveConvertUnicode(configValue).getBytes(),
configName);
}
else if (propertySourceLoader instanceof YamlPropertySourceLoader) {
// YamlPropertySourceLoader internal only support use unicode,
// The default encoding for Chinese windows system is GBK, need to transform
nacosByteArrayResource = new NacosByteArrayResource(
configValue.getBytes(StandardCharsets.UTF_8), configName);
}
else {
nacosByteArrayResource = new NacosByteArrayResource(
configValue.getBytes(), configName);
Expand Down