Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Java resource-file encoding problems are fixed by making three things agree: the file’s actual bytes, the build’s copy or filtering step, and the API that reads the file at runtime. Start by identifying that API; a Properties file read with Properties.load(InputStream) does not have the same encoding rules as a property bundle loaded by ResourceBundle.
Why Java resource files display incorrectly
A resource is a non-source file—such as a properties file, XML document, or image—that a build copies into its output. Maven’s Resources Plugin and Gradle’s processResources task handle that work. If a text file is decoded and rewritten during filtering, the build can change its bytes before the application reads it. At runtime, the chosen Java API may then interpret those bytes using a different charset.
The visible symptoms include mojibake, replacement characters, or an exception such as MalformedInputException. An editor preview alone cannot identify the cause: it may render bytes using its own charset rather than the one used by the build or application.
Identify how the application reads the file
First find the code or framework that consumes the resource. Do not select a charset based only on the file extension or how it looks in an editor.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →| Consumer or operation | Encoding consideration |
|---|---|
Properties.load(InputStream) |
The Properties API expects ISO-8859-1 input; non-Latin-1 characters are conventionally represented with Unicode escapes. See Maven’s encoding guidance. |
Property ResourceBundle |
Java SE 9 and later prefer UTF-8 for property bundles. Legacy data may require conversion or an explicit compatibility setting. See Oracle’s internationalization guide. |
| Custom reader or framework loader | Check the loader’s documented charset or the charset explicitly passed to InputStreamReader. The API’s behavior, not the filename, determines how bytes are decoded. |
| Build filtering | Filtering substitutes variables in text resources and may decode and rewrite content. It is distinct from runtime reading; binary resources should be copied unchanged. |
Check the file’s actual bytes
- Inspect the resource with an editor or byte-level utility that can report the encoding. Check specifically for a UTF-8 byte-order mark (BOM), unexpected legacy bytes, and whether the file is valid in the charset you intend to use.
- Choose a consistent project policy, normally UTF-8 for newly created text resources, and convert legacy files deliberately rather than merely changing a configuration value.
- For files read through
Properties.load(InputStream), account for its ISO-8859-1 input requirement. A UTF-8 build setting does not change the API’s runtime rules.
Oracle states that since Java SE 9, properties files loaded as property bundles use UTF-8. That version change does not make every API that reads a .properties file use UTF-8.
Set Maven resource encoding explicitly
Maven’s Resources Plugin copies resources to build output and can filter them. Define an explicit source encoding so filtered text resources do not depend on a machine’s default charset. Maven calls ${project.build.sourceEncoding} its best-practice property for filtered-resource encoding; the plugin also has an encoding setting and a separate propertiesEncoding setting for filtered properties files.
Rank #2
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.5.0</version>
<configuration>
<encoding>UTF-8</encoding>
<propertiesEncoding>UTF-8</propertiesEncoding>
</configuration>
</plugin>
</plugins>
</build>
This example sets UTF-8 for Maven’s resource processing. It is appropriate when those filtered resources are actually UTF-8; it does not override a runtime API’s decoding contract. If filtered .properties files use a legacy charset, set propertiesEncoding to that charset instead. Maven introduced that separate parameter in Resources Plugin 3.2.0; verify the plugin version in your project supports it.
Configure Gradle without rewriting the wrong files
The Java plugin processes src/main/resources with processResources, placing resources in the production output and runtime classpath. Because this is a copy-style task, it can also filter, rename, or otherwise modify files. Apply content filtering only to intended text resources; exclude images and other binary files, and ensure template placeholders are not interpreted in resources that should remain byte-for-byte unchanged.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallGradle notes that most Java tools use the system file encoding when none is specified. To pin the Gradle JVM’s file encoding, add this to the project’s gradle.properties:
org.gradle.jvmargs=-Dfile.encoding=UTF-8
This controls the Gradle JVM’s file-encoding property; it is not a substitute for checking how a specific task filters content or how the application reads the resource.
Rank #4
Handle Java ResourceBundle compatibility and malformed UTF-8
With Java 9 and later, PropertyResourceBundle reads property bundles as UTF-8 by default. For legacy bundles, Oracle documents two remedies: convert the file to UTF-8, or set java.util.PropertyResourceBundle.encoding=ISO-8859-1 when compatibility with ISO-8859-1 data is required.
If UTF-8 is explicitly selected and the input contains an invalid UTF-8 byte sequence, loading can fail with MalformedInputException. That is evidence that the bytes and required decoder do not agree—not a reason to replace arbitrary bytes or suppress the exception. Convert the file to valid UTF-8, or use the documented legacy override only when the file’s actual encoding and application requirements justify it. See the Java API documentation for PropertyResourceBundle.
Best Value
Verify the built resource, not just the source file
- Build the project, then inspect the resource in Maven’s
target/classesor the Gradle resources output directory. - If filtering is enabled, compare the source and output bytes for text resources that should not change beyond intended substitutions. Confirm binary resources were copied unchanged.
- Inspect the resource entry in the packaged JAR. A correct source file does not prove the packaged entry retained the same encoding.
- Run a small load check using the same API and Java version as production. Test the characters that were previously corrupted, and check for decoding exceptions.
If the source bytes are correct but the build output differs unexpectedly, review filtering and its charset configuration. If the output bytes are correct but runtime text is wrong, focus on the consuming API and its decoding rules.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

