-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only detet US-ASCII if there are printable characters, new lines and …
…tabs #33
- Loading branch information
1 parent
f6efa33
commit 8ba6fb3
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/test/java/org/mozilla/universalchardet/Bug33USASCIIToGenerous.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.mozilla.universalchardet; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
|
||
public class Bug33USASCIIToGenerous { | ||
|
||
public Bug33USASCIIToGenerous() { | ||
super(); | ||
} | ||
|
||
|
||
|
||
@Test | ||
@Ignore("Not sure") | ||
public void testUTF16 () throws IOException { | ||
Assert.assertEquals("UTF-16BE", detect("ab".getBytes("UTF-16BE"))); | ||
Assert.assertEquals("UTF-16LE", detect("ab".getBytes("UTF-16LE"))); | ||
} | ||
@Test | ||
public void testZipHeader() throws IOException { | ||
byte[] zipHeader = new byte[]{0x50, 0x4b, 0x03, 0x04, 0x14, 0x00, 0x02, 0x00}; | ||
Assert.assertNull(detect(zipHeader)); | ||
} | ||
|
||
private String detect(byte[] data) throws IOException { | ||
return UniversalDetector.detectCharset(new ByteArrayInputStream(data)); | ||
} | ||
|
||
} |