I'm trying to load a proprieties from a text file, but the accented characters (saül) comes in a different encoding other than UTF-8 how to avoid it?
My property file have a property with an accented character (saül). How ever when I remote debug I find that properties.load(bufferedReader); takes that as saül so when I write to another file it gets written as saül, I have UTF-8 encoding everywhere else in the application. I'm not sure what I'm doing wrong while reading the properties from the file.
try {
final String propertyFilePath = System.getProperty(JVM_ARGUMENT_NAME);
if (StringUtils.hasText(propertyFilePath)) {
setLocalOverride(true);
resource = getApplicationContext().getResource(propertyFilePath);
BufferedReader bufferedReader =
new BufferedReader(new InputStreamReader(new FileInputStream(propertyFilePath), "UTF8"));
properties.load(bufferedReader);
externalFilePasswordConfigurer.afterPasswordPropertiesSet(properties);
LOGGER.info("ExternalFilePropertyConfigurer UTF-8 Reader");
}
setProperties(properties);
logProperties(properties);
} catch (Exception e) {
LOGGER.error("ExternalFilePropertyConfigurer setter failed to set properties: ", e);
throw new RuntimeException(e);
}