spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

Fixed local dependent writing of banner into ByteArrayOutputStream

Open totti-dev opened this issue 1 year ago • 2 comments

Curently 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));"

totti-dev avatar Feb 16 '24 11:02 totti-dev

@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.

pivotal-cla avatar Feb 16 '24 11:02 pivotal-cla

@alvican Thank you for signing the Contributor License Agreement!

pivotal-cla avatar Feb 16 '24 11:02 pivotal-cla

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

mhalbritter avatar Feb 19 '24 10:02 mhalbritter