-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #266 from simlu/develop
Chinese, Collada Export Options, Misc
- Loading branch information
Showing
8 changed files
with
884 additions
and
39 deletions.
There are no files selected for viewing
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.vitco.app.util.misc; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
import java.util.Locale; | ||
import java.util.PropertyResourceBundle; | ||
import java.util.ResourceBundle; | ||
import java.util.ResourceBundle.Control; | ||
|
||
// Reference: https://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle | ||
|
||
public class UTF8Control extends Control { | ||
|
||
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) | ||
throws IllegalAccessException, InstantiationException, IOException | ||
{ | ||
// The below is a copy of the default implementation. | ||
String bundleName = toBundleName(baseName, locale); | ||
String resourceName = toResourceName(bundleName, "properties"); | ||
ResourceBundle bundle = null; | ||
InputStream stream = null; | ||
if (reload) { | ||
URL url = loader.getResource(resourceName); | ||
if (url != null) { | ||
URLConnection connection = url.openConnection(); | ||
if (connection != null) { | ||
connection.setUseCaches(false); | ||
stream = connection.getInputStream(); | ||
} | ||
} | ||
} else { | ||
stream = loader.getResourceAsStream(resourceName); | ||
} | ||
if (stream != null) { | ||
try ( | ||
InputStreamReader inputStreamReader = new InputStreamReader(stream, "UTF-8") | ||
){ | ||
// Read properties files as user defined and if not provided then use "UTF-8" encoding. | ||
bundle = new PropertyResourceBundle(inputStreamReader); | ||
} | ||
} | ||
return bundle; | ||
} | ||
} |