Sfoglia il codice sorgente

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>
tags/V1_9_21_1
Alexander Kriegisch 4 mesi fa
parent
commit
a8eab70a29
1 ha cambiato i file con 6 aggiunte e 4 eliminazioni
  1. 6
    4
      build/src/main/java/$installer$/org/aspectj/Main.java

+ 6
- 4
build/src/main/java/$installer$/org/aspectj/Main.java Vedi File

import javax.swing.border.CompoundBorder; import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder; 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: * Invoke the Installer gui. There are two ways to run without GUI by passing parameters to main:
* <ol> * <ol>
} }


public static String stringFromStream(InputStream stream) throws IOException { 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(); StringBuilder ret = new StringBuilder();
int data; int data;


public void writeTextStream(InputStream zis, File outputFile) throws IOException { public void writeTextStream(InputStream zis, File outputFile) throws IOException {
BufferedWriter os = new BufferedWriter(new FileWriter(outputFile)); 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; String l;
while ((l = r.readLine()) != null) { while ((l = r.readLine()) != null) {
} }


// InputStream stream = url.openStream(); // 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(); // String line = reader.readLine();
// installPane.nBytes = Integer.parseInt(line); // installPane.nBytes = Integer.parseInt(line);
// //


public void writeTextStream(ZipInputStream zis, File outputFile) throws IOException { public void writeTextStream(ZipInputStream zis, File outputFile) throws IOException {
BufferedWriter os = new BufferedWriter(new FileWriter(outputFile)); 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; String l;
while ((l = r.readLine()) != null) { while ((l = r.readLine()) != null) {

Loading…
Annulla
Salva