mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
load properties files using UTF-8 instead of ISO 8859-1 (issue #1031)
This commit is contained in:
@@ -22,6 +22,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
@@ -177,7 +178,7 @@ class FlatCompletionProvider
|
||||
try {
|
||||
try( InputStream in = getClass().getResourceAsStream( "/com/formdev/flatlaf/themeeditor/FlatLafUIKeys.txt" ) ) {
|
||||
if( in != null ) {
|
||||
try( BufferedReader reader = new BufferedReader( new InputStreamReader( in, "UTF-8" ) ) ) {
|
||||
try( BufferedReader reader = new BufferedReader( new InputStreamReader( in, StandardCharsets.UTF_8 ) ) ) {
|
||||
String key;
|
||||
while( (key = reader.readLine()) != null ) {
|
||||
if( !isIgnored( key ) )
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.awt.Window;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import javax.swing.Action;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.InputMap;
|
||||
@@ -211,7 +212,7 @@ class FlatThemeEditorPane
|
||||
void load( File file ) throws IOException {
|
||||
this.file = file;
|
||||
|
||||
textArea.load( FileLocation.create( file ), "UTF-8" );
|
||||
textArea.load( FileLocation.create( file ), StandardCharsets.UTF_8 );
|
||||
}
|
||||
|
||||
boolean reloadIfNecessary() {
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.Year;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -675,7 +676,7 @@ class FlatThemeFileEditor
|
||||
{
|
||||
try(
|
||||
FileOutputStream out = new FileOutputStream( file );
|
||||
Writer writer = new OutputStreamWriter( out, "UTF-8" );
|
||||
Writer writer = new OutputStreamWriter( out, StandardCharsets.UTF_8 );
|
||||
) {
|
||||
writer.write( content );
|
||||
}
|
||||
|
||||
@@ -19,6 +19,9 @@ package com.formdev.flatlaf.themeeditor;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -109,8 +112,11 @@ class FlatThemePropertiesBaseManager
|
||||
String propertiesName = '/' + lafClass.getName().replace( '.', '/' ) + ".properties";
|
||||
try( InputStream in = lafClass.getResourceAsStream( propertiesName ) ) {
|
||||
Properties properties = new Properties();
|
||||
if( in != null )
|
||||
properties.load( in );
|
||||
if( in != null ) {
|
||||
try( Reader reader = new InputStreamReader( in, StandardCharsets.UTF_8 )) {
|
||||
properties.load( in );
|
||||
}
|
||||
}
|
||||
coreThemes.put( lafClass.getSimpleName(), properties );
|
||||
} catch( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
|
||||
Reference in New Issue
Block a user