mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 08:18:52 -05:00
* fixed encoding problem, added unit test
This commit is contained in:
parent
64eb0ab911
commit
9be7101759
@ -145,8 +145,8 @@ public final class WebRequest {
|
||||
}
|
||||
}
|
||||
|
||||
// use http default encoding if charset cannot be determined
|
||||
return Charset.forName("ISO-8859-1");
|
||||
// use http default encoding only for text/html, use UTF-8 for everything else (e.g. XML)
|
||||
return Charset.forName(contentType.equals("text/html") ? "ISO-8859-1" : "UTF-8");
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,11 +24,17 @@ public class AnidbClientTest {
|
||||
*/
|
||||
private static HyperLink twelvekingdomsSearchResult;
|
||||
|
||||
/**
|
||||
* 38 episodes, lots of special characters
|
||||
*/
|
||||
private static HyperLink princessTutuSearchResult;
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpBeforeClass() throws Exception {
|
||||
monsterSearchResult = new HyperLink("Monster", new URL("http://anidb.net/perl-bin/animedb.pl?show=anime&aid=1539"));
|
||||
twelvekingdomsSearchResult = new HyperLink("Juuni Kokuki", new URL("http://anidb.net/a26"));
|
||||
princessTutuSearchResult = new HyperLink("Princess Tutu", new URL("http://anidb.net/a516"));
|
||||
}
|
||||
|
||||
|
||||
@ -125,6 +131,12 @@ public class AnidbClientTest {
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListEncoding() throws Exception {
|
||||
assertEquals("Raven Princess - An der schönen blauen Donau", anidb.getEpisodeList(princessTutuSearchResult).get(6).getTitle());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListTrimRecap() throws Exception {
|
||||
assertEquals("Sea God of the East, Azure Sea of the West - Transition Chapter", anidb.getEpisodeList(twelvekingdomsSearchResult).get(44).getTitle());
|
||||
|
Loading…
Reference in New Issue
Block a user