Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

totti-dev
Copy link

@totti-dev totti-dev commented Feb 16, 2024

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

@pivotal-cla
Copy link

@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
Copy link

@alvican Thank you for signing the Contributor License Agreement!

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 16, 2024
@mhalbritter mhalbritter self-assigned this Feb 19, 2024
@mhalbritter mhalbritter changed the title Fixed local dependent writing of banner into ByteArrayOutputStream Banner printing doesn't respect set charset Feb 19, 2024
@mhalbritter mhalbritter added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Feb 19, 2024
@mhalbritter mhalbritter added this to the 3.1.x milestone Feb 19, 2024
@mhalbritter
Copy link
Contributor

Thank you very much and congratulations on your first contribution 🎉!

@mhalbritter mhalbritter modified the milestones: 3.1.x, 3.1.9 Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants