Currently the printing of the banner in log mode (spring.main.banner-mode="log") only works correctly (correctly = displays unicode characters the correct way, without surrogate glyphs) if spring.banner.charset matches file.encoding. The banner is read using the encoding specified by spring.banner.charset, before it is written in a local dependent way (dependent on file.encoding) into the ByteArrayOutputStream. After that it is re-read using the original spring.banner.charset. This leads to unwanted replacements.

Proposed Solution -> Write banner into ByteArrayOutputStream using the original encoding and not the local dependent encoding.

Affected method: createStringFromBanner(Banner banner, Environment environment, Class<?> mainApplicationClass)

Local dependent writing by using PrintStream constructor with single argument (no encoding specified) banner.printBanner(environment, mainApplicationClass, new PrintStream(baos));

Comment From: pivotal-cla

@alvican Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@alvican Thank you for signing the Contributor License Agreement!

Comment From: mhalbritter

Thank you very much and congratulations on your first contribution :tada:!