Skip to content

Commit 82b711d

Browse files
committed
Load plugin message bundles with system file.encoding. Fixes #9821
1 parent 86518a2 commit 82b711d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

grails-core/src/main/groovy/org/grails/plugins/BinaryGrailsPlugin.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import java.io.File;
3232
import java.io.IOException;
3333
import java.io.InputStream;
34+
import java.io.InputStreamReader;
3435
import java.net.URL;
36+
import java.nio.charset.Charset;
3537
import java.util.*;
3638

3739
/**
@@ -49,6 +51,7 @@ public class BinaryGrailsPlugin extends DefaultGrailsPlugin {
4951
public static final String RELATIVE_VIEWS_PROPERTIES = "../gsp/views.properties";
5052
public static final char UNDERSCORE = '_';
5153
public static final String PROPERTIES_EXTENSION = ".properties";
54+
public static final String DEFAULT_PROPERTIES_ENCODING = "UTF-8";
5255

5356
private final BinaryGrailsPluginDescriptor descriptor;
5457
private Class[] providedArtefacts = {};
@@ -284,7 +287,7 @@ private void loadFromResources(Properties properties, Resource[] resources) thro
284287
for (Resource messageResource : resources) {
285288
InputStream inputStream = messageResource.getInputStream();
286289
try {
287-
properties.load(inputStream);
290+
properties.load(new InputStreamReader(inputStream, Charset.forName(System.getProperty("file.encoding", DEFAULT_PROPERTIES_ENCODING))));
288291
} finally {
289292
try {
290293
inputStream.close();

0 commit comments

Comments
 (0)