Describe the bug
In Spring Cloud Kubernetes 2.1.1, the YAML document extracted from a ConfigMap is retrieved as a String, then encoded to bytes with getBytes() to be wrapped in a ByteArrayResource. getBytes() is called without an encoding, which default to the platform default encoding, which might not be UTF-8. This leads to encoding issues when the YAML document contains characters unsupported by the platform encoding. Also, per-spec, YAML documents are UTF encoded.
Here is the faulty line:
|
yamlFactory.setResources(new ByteArrayResource(s.getBytes())); |
A workaround is to force the JVM encoding with -Dfile.encoding=UTF-8 but this might not always be suitable.