Use UTF-8 encoding. Fixes #577

This commit is contained in:
Ryan Baxter
2019-09-03 11:36:37 -04:00
parent 3c5c7118fe
commit 1e434831b4

View File

@@ -18,6 +18,7 @@ package org.springframework.cloud.consul.config;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -157,7 +158,8 @@ public class ConsulPropertySource extends EnumerablePropertySource<ConsulClient>
}
else if (format == YAML) {
final YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
yaml.setResources(new ByteArrayResource(value.getBytes()));
yaml.setResources(
new ByteArrayResource(value.getBytes(Charset.forName("UTF-8"))));
return yaml.getObject();
}