Revise encoding steps towards use of JDK Charset and StandardCharsets
Issue: SPR-14492
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.core.convert.support;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.core.convert.converter.Converter;
|
||||
@@ -35,7 +36,7 @@ final class StringToPropertiesConverter implements Converter<String, Properties>
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
// Must use the ISO-8859-1 encoding because Properties.load(stream) expects it.
|
||||
props.load(new ByteArrayInputStream(source.getBytes("ISO-8859-1")));
|
||||
props.load(new ByteArrayInputStream(source.getBytes(StandardCharsets.ISO_8859_1)));
|
||||
return props;
|
||||
}
|
||||
catch (Exception ex) {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package org.springframework.util;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
@@ -31,7 +32,7 @@ import java.util.Base64;
|
||||
*/
|
||||
public abstract class Base64Utils {
|
||||
|
||||
private static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
|
||||
private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user