From 1e434831b45492c344e4a13fb4e5ecd2f2a1faf1 Mon Sep 17 00:00:00 2001 From: Ryan Baxter Date: Tue, 3 Sep 2019 11:36:37 -0400 Subject: [PATCH] Use UTF-8 encoding. Fixes #577 --- .../cloud/consul/config/ConsulPropertySource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java index 83468b2f..9332a659 100644 --- a/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java +++ b/spring-cloud-consul-config/src/main/java/org/springframework/cloud/consul/config/ConsulPropertySource.java @@ -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 } 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(); }