diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-01-05 14:35:24 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2024-01-06 10:09:11 +0100 |
commit | a8eab70a29dc55514fd523371762d286ca7082df (patch) | |
tree | a8e9cb681db92ef2d926f212b81e2d334050159f | |
parent | e090edbfb42556d49f7a618ceebb3f64b2341a30 (diff) | |
download | aspectj-a8eab70a29dc55514fd523371762d286ca7082df.tar.gz aspectj-a8eab70a29dc55514fd523371762d286ca7082df.zip |
Bugfix: AspectJ installer extracts text files as US-ASCII
When extracting text or HTML files, special characters like German
umlauts "ÄÖÜäöüß" or copyright symbol "©" were destroyed while unpacking
the installer archive. As our files in Git SCM are all UTF-8, the
installer now also uses UTF-8 to read and write text files.
Fixes #270.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
-rw-r--r-- | build/src/main/java/$installer$/org/aspectj/Main.java | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/build/src/main/java/$installer$/org/aspectj/Main.java b/build/src/main/java/$installer$/org/aspectj/Main.java index d11ba8f6b..068258311 100644 --- a/build/src/main/java/$installer$/org/aspectj/Main.java +++ b/build/src/main/java/$installer$/org/aspectj/Main.java @@ -67,6 +67,8 @@ import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; +import static java.nio.charset.StandardCharsets.UTF_8; + /** * Invoke the Installer gui. There are two ways to run without GUI by passing parameters to main: * <ol> @@ -678,7 +680,7 @@ abstract class WizardPane { } public static String stringFromStream(InputStream stream) throws IOException { - BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "US-ASCII")); + BufferedReader reader = new BufferedReader(new InputStreamReader(stream, UTF_8)); StringBuilder ret = new StringBuilder(); int data; @@ -1345,7 +1347,7 @@ class CurrentJarUnpacker { public void writeTextStream(InputStream zis, File outputFile) throws IOException { BufferedWriter os = new BufferedWriter(new FileWriter(outputFile)); - BufferedReader r = new BufferedReader(new InputStreamReader(zis, "US-ASCII")); + BufferedReader r = new BufferedReader(new InputStreamReader(zis, UTF_8)); String l; while ((l = r.readLine()) != null) { @@ -1386,7 +1388,7 @@ class CurrentJarUnpacker { } // InputStream stream = url.openStream(); -// BufferedReader reader = new BufferedReader(new InputStreamReader(stream, "US-ASCII")); +// BufferedReader reader = new BufferedReader(new InputStreamReader(stream, UTF_8)); // String line = reader.readLine(); // installPane.nBytes = Integer.parseInt(line); // @@ -1727,7 +1729,7 @@ class JarUnpacker { public void writeTextStream(ZipInputStream zis, File outputFile) throws IOException { BufferedWriter os = new BufferedWriter(new FileWriter(outputFile)); - BufferedReader r = new BufferedReader(new InputStreamReader(zis, "US-ASCII")); + BufferedReader r = new BufferedReader(new InputStreamReader(zis, UTF_8)); String l; while ((l = r.readLine()) != null) { |