Q:

How can I read äöüß in java?

   import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

public class Test {

    List<String> knownWordsArrayList = new ArrayList<String>();
    List<String> wordsArrayList = new ArrayList<String>();
    List<String> newWordsArrayList = new ArrayList<String>();
    String toFile = "";

    public void readKnownWordsFile() {
        try {
            FileInputStream fstream2 = new FileInputStream("knownWords.txt");

            BufferedReader br2 = new BufferedReader(new InputStreamReader(fstream2, "UTF-8"));
            String strLine;
            while ((strLine = br2.readLine()) != null) {
                knownWordsArrayList.add(strLine.toLowerCase());
            }
            HashSet h = new HashSet(knownWordsArrayList);
            // h.removeAll(knownWordsArrayList);
            knownWordsArrayList = new ArrayList<String>(h);
            // for (int i = 0; i < knownWordsArrayList.size(); i++) {
            // System.out.println(knownWordsArrayList.get(i));
            // }
        } catch (Exception e) {
            // TODO: handle exception
        }

    }

    public void readFile() {
        try {
            // Open the file that is the first
            // command line parameter
            FileInputStream fstream = new FileInputStream("Smallville 4x02.de.srt");

            BufferedReader br = new BufferedReader(new InputStreamReader(fstream));

            String strLine;

            String numberedLineRemoved = "";
            String strippedInput = "";
            String[] words;
            String trimmedString = "";
            String temp = "";
            // Read File Line By Line
            while ((strLine = br.readLine()) != null) {
                temp = strLine.toLowerCase();
                // Print the content on the console
                numberedLineRemoved = numberedLine(temp);
                strippedInput = numberedLineRemoved.replaceAll("\\p{Punct}", "");
                if ((strippedInput.trim().length() != 0) || (!strippedInput.contains("")) || (strippedInput.contains(" "))) {
                    words = strippedInput.split("\\s+");
                    for (int i = 0; i < words.length; i++) {
                        if (words[i].trim().length() != 0) {
                            wordsArrayList.add(words[i]);
                        }
                    }
                }
            }

            HashSet h = new HashSet(wordsArrayList);
            h.removeAll(knownWordsArrayList);
            newWordsArrayList = new ArrayList<String>(h);

            // HashSet h = new HashSet(wordsArrayList);
            // wordsArrayList.clear();
            // newWordsArrayList.addAll(h);

            for (int i = 0; i < newWordsArrayList.size(); i++) {
                toFile = newWordsArrayList.get(i) + ".\n";
//              System.out.println(newWordsArrayList.get(i) + ".");
                System.out.println();
            }

            System.out.println(newWordsArrayList.size());
            // Close the input stream
            in.close();
        } catch (Exception e) {// Catch exception if any
            System.err.println("Error: " + e.getMessage());
        }
    }

    public String numberedLine(String string) {
        if (string.matches(".*\\d.*")) {
            return "";
        } else {
            return string;
        }
    }

    public void writeToFile() {
        try {
            // Create file
            FileWriter fstream = new FileWriter("out.txt");
            BufferedWriter out = new BufferedWriter(fstream);
            out.write(toFile);
            // Close the output stream
            out.close();
        } catch (Exception e) {// Catch exception if any
            System.err.println("Error: " + e.getMessage());
        }
    }

    public static void main(String[] args) {
        Test test = new Test();
        test.readKnownWordsFile();
        test.readFile();
        test.writeToFile();

    }

}

How can I read äöüß from file? 
Would the string.toLowercase() handle these properly as well? 
And when I go to print words containing any of äöüß, how can I print the word properly?
When I print to console I get 
AuÃŸerdem
weiÃŸ
for Außerdem
weiß
How can I fix this?
I tried: 
BufferedReader br = new BufferedReader(new InputStreamReader(in, "UTF-8"));

But now I'm getting aufkl?ren instead of aufklären and its messing up in other places as well.
Updated the code to see if it would print on the file properly, but I'm just getting one in the file.

A:

You need to read files using the charset which was used to create the file.  If you're on a windows machine, that's probably cp1252.  So:
BufferedReader br = new BufferedReader(new InputStreamReader(in, "Cp1252"));

If that doesn't work, most text editors are capable of telling you what encoding is used for a given document.

