diff options
Diffstat (limited to 'test/062-character-encodings')
-rw-r--r-- | test/062-character-encodings/expected.txt | 1 | ||||
-rw-r--r-- | test/062-character-encodings/info.txt | 1 | ||||
-rw-r--r-- | test/062-character-encodings/src/Main.java | 25 |
3 files changed, 27 insertions, 0 deletions
diff --git a/test/062-character-encodings/expected.txt b/test/062-character-encodings/expected.txt new file mode 100644 index 0000000..b395a2a --- /dev/null +++ b/test/062-character-encodings/expected.txt @@ -0,0 +1 @@ +Missing: [] diff --git a/test/062-character-encodings/info.txt b/test/062-character-encodings/info.txt new file mode 100644 index 0000000..bdf60bf --- /dev/null +++ b/test/062-character-encodings/info.txt @@ -0,0 +1 @@ +Test that the list of character encodings is what we expect. diff --git a/test/062-character-encodings/src/Main.java b/test/062-character-encodings/src/Main.java new file mode 100644 index 0000000..6e9f0cd --- /dev/null +++ b/test/062-character-encodings/src/Main.java @@ -0,0 +1,25 @@ +import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.SortedMap; +import java.util.Set; + +public class Main { + static public void main(String[] args) throws Exception { + // These charsets must be provided; anything else is optional. + List<String> standardCharsets = Arrays.asList("US-ASCII", "ISO-8859-1", + "UTF-8", "UTF-16BE", "UTF-16LE", "UTF-16"); + + SortedMap<String, Charset> all = Charset.availableCharsets(); + Set<String> needed = new HashSet<String>(standardCharsets); + for (Map.Entry<String, Charset> e : all.entrySet()) { + String canonicalName = e.getKey(); + needed.remove(canonicalName); + } + System.out.println("Missing: " + needed); + } +} |