Skip to content

Commit

Permalink
update test to not rely on UTF-8 encoding (eclipse-ee4j#103)
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Jungmann <[email protected]>
  • Loading branch information
lukasj authored and m0mus committed Nov 13, 2018
1 parent e89842c commit af3e785
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/test/java/mime/MimeUtilityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,15 @@ public void testDecodeWord() throws UnsupportedEncodingException, ParseException
}

public void testEncodeDecodeWithDefaults() throws UnsupportedEncodingException, ParseException {
//use non-ascii word since ascii is not encoded
String word = "abc\u0b85";
String word = null;
String encoding = System.getProperty("file.encoding");
//use non-ascii word since ascii is not encoded
if (encoding != null && encoding.toLowerCase().startsWith("utf")) {
word = "abc\u0b85";
} else {
//use a character from first 256 values for non-UTF encodings
word = "abc\u00F5";
}
String encodedWord = MimeUtility.encodeWord(word);
String decodedWord = MimeUtility.decodeWord(encodedWord);
assertEquals(word, decodedWord);
Expand Down

0 comments on commit af3e785

Please sign in to comment.