Set charset encoding explicitly when calling String#getBytes

MSAL

This makes the behavior of the code platform neutral. It will not override any existing explicit encodings, even if they don't match the default encoding option. Relying on the platform default charset can produce different results across environments, leading to subtle data corruption bugs.

org.openrewrite.staticanalysis.ExplicitCharsetOnStringGetBytes

Optional

The default encoding to supply to the getBytes call.

mod run . --recipe=org.openrewrite.staticanalysis.ExplicitCharsetOnStringGetBytes

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.