fixed chinese garbled for nacos-config

pull/1939/head
zkzlx 4 years ago
parent bb7afd9033
commit a81430a965

@ -26,6 +26,7 @@ import java.util.Objects;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.cloud.nacos.utils.NacosConfigUtils; import com.alibaba.cloud.nacos.utils.NacosConfigUtils;
import org.springframework.boot.env.OriginTrackedMapPropertySource; import org.springframework.boot.env.OriginTrackedMapPropertySource;
import org.springframework.boot.env.PropertiesPropertySourceLoader; import org.springframework.boot.env.PropertiesPropertySourceLoader;
import org.springframework.boot.env.PropertySourceLoader; import org.springframework.boot.env.PropertySourceLoader;

@ -79,7 +79,7 @@ public class NacosXmlPropertySourceLoader extends AbstractPropertySourceLoader
* return a list containing a single source, or in the case of a multi-document format * return a list containing a single source, or in the case of a multi-document format
* such as yaml a source for each document in the resource. * such as yaml a source for each document in the resource.
* @param name the root name of the property source. If multiple documents are loaded * @param name the root name of the property source. If multiple documents are loaded
* an additional suffix should be added to the name for each source loaded. * an additional suffix should be added to the name for each source loaded.
* @param resource the resource to load * @param resource the resource to load
* @return a list property sources * @return a list property sources
* @throws IOException if the source cannot be loaded * @throws IOException if the source cannot be loaded

@ -21,10 +21,13 @@ package com.alibaba.cloud.nacos.utils;
*/ */
public final class NacosConfigUtils { public final class NacosConfigUtils {
private NacosConfigUtils(){
}
/** /**
* Convert Chinese characters to Unicode. * Convert Chinese characters to Unicode.
* @param configValue * @param configValue value of config
* @return * @return new string
*/ */
public static String selectiveConvertUnicode(String configValue) { public static String selectiveConvertUnicode(String configValue) {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -42,8 +45,8 @@ public final class NacosConfigUtils {
/** /**
* char is chinese? * char is chinese?
* @param c * @param c a character
* @return * @return true or false
*/ */
public static boolean isChinese(char c) { public static boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c); Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);

Loading…
Cancel
Save