In Java I can get all the available encodings with this code:
SortedMap<String, Charset> availableCharsets = Charset.availableCharsets();
Vector allEncodes = new Vector();
for (Map.Entry<String, Charset> entry : availableCharsets.entrySet()) {
allEncodes.add(entry.getKey());
}
Then, I can read any file with any encode I want:
Reader in = new InputStreamReader(new FileInputStream(aPath), allEncodes.get(0) );
So, is there any idea how to implement this in Objective-C
This is more or less translation of your code from Java. You need also to complete the code checking
readingErrorvariable. Of course, central point isavaiableStringEncodingsstatic message.