mirror of
https://github.com/zxing/zxing.git
synced 2024-11-10 13:04:05 -08:00
Added ECI for values 0-2 and also standardize character encoding names throughout the code to use the canonical values for java.lang and java.io
git-svn-id: https://zxing.googlecode.com/svn/trunk@468 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
c9ead4ce8a
commit
584564a594
|
@ -58,7 +58,7 @@ public final class NDEFTextParsedResult extends AbstractNDEFParsedResult {
|
||||||
int languageLength = statusByte & 0x1F;
|
int languageLength = statusByte & 0x1F;
|
||||||
// language is always ASCII-encoded:
|
// language is always ASCII-encoded:
|
||||||
String language = bytesToString(payload, 1, languageLength, "US-ASCII");
|
String language = bytesToString(payload, 1, languageLength, "US-ASCII");
|
||||||
String encoding = isUTF16 ? "UTF-16" : "UTF-8";
|
String encoding = isUTF16 ? "UTF-16" : "UTF8";
|
||||||
String text = bytesToString(payload, 1 + languageLength, payload.length - languageLength - 1, encoding);
|
String text = bytesToString(payload, 1 + languageLength, payload.length - languageLength - 1, encoding);
|
||||||
return new String[] { language, text };
|
return new String[] { language, text };
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public final class NDEFURIParsedResult extends AbstractNDEFParsedResult {
|
||||||
if (identifierCode < URI_PREFIXES.length) {
|
if (identifierCode < URI_PREFIXES.length) {
|
||||||
prefix = URI_PREFIXES[identifierCode];
|
prefix = URI_PREFIXES[identifierCode];
|
||||||
}
|
}
|
||||||
String restOfURI = bytesToString(payload, 1, payload.length - 1, "UTF-8");
|
String restOfURI = bytesToString(payload, 1, payload.length - 1, "UTF8");
|
||||||
return prefix == null ? restOfURI : prefix + restOfURI;
|
return prefix == null ? restOfURI : prefix + restOfURI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,9 @@ final class CharacterSetECI extends ECI {
|
||||||
static {
|
static {
|
||||||
VALUE_TO_ECI = new Hashtable(29);
|
VALUE_TO_ECI = new Hashtable(29);
|
||||||
// TODO figure out if these values are even right!
|
// TODO figure out if these values are even right!
|
||||||
|
addCharacterSet(0, "Cp437");
|
||||||
|
addCharacterSet(1, "ISO8859_1");
|
||||||
|
addCharacterSet(2, "Cp437");
|
||||||
addCharacterSet(3, "ISO8859_1");
|
addCharacterSet(3, "ISO8859_1");
|
||||||
addCharacterSet(4, "ISO8859_2");
|
addCharacterSet(4, "ISO8859_2");
|
||||||
addCharacterSet(5, "ISO8859_3");
|
addCharacterSet(5, "ISO8859_3");
|
||||||
|
@ -44,7 +47,7 @@ final class CharacterSetECI extends ECI {
|
||||||
addCharacterSet(16, "ISO8859_14");
|
addCharacterSet(16, "ISO8859_14");
|
||||||
addCharacterSet(17, "ISO8859_15");
|
addCharacterSet(17, "ISO8859_15");
|
||||||
addCharacterSet(18, "ISO8859_16");
|
addCharacterSet(18, "ISO8859_16");
|
||||||
addCharacterSet(20, "Shift_JIS");
|
addCharacterSet(20, "SJIS");
|
||||||
}
|
}
|
||||||
|
|
||||||
private final String encodingName;
|
private final String encodingName;
|
||||||
|
|
|
@ -40,11 +40,11 @@ final class DecodedBitStreamParser {
|
||||||
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
|
||||||
' ', '$', '%', '*', '+', '-', '.', '/', ':'
|
' ', '$', '%', '*', '+', '-', '.', '/', ':'
|
||||||
};
|
};
|
||||||
private static final String SHIFT_JIS = "Shift_JIS";
|
private static final String SHIFT_JIS = "SJIS";
|
||||||
private static final String EUC_JP = "EUC-JP";
|
private static final String EUC_JP = "EUC_JP";
|
||||||
private static final boolean ASSUME_SHIFT_JIS;
|
private static final boolean ASSUME_SHIFT_JIS;
|
||||||
private static final String UTF8 = "UTF-8";
|
private static final String UTF8 = "UTF8";
|
||||||
private static final String ISO88591 = "ISO-8859-1";
|
private static final String ISO88591 = "ISO8859_1";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
String platformDefault = System.getProperty("file.encoding");
|
String platformDefault = System.getProperty("file.encoding");
|
||||||
|
|
|
@ -180,7 +180,7 @@ public abstract class AbstractBlackBoxTestCase extends TestCase {
|
||||||
|
|
||||||
private static String readFileAsString(File file) throws IOException {
|
private static String readFileAsString(File file) throws IOException {
|
||||||
StringBuilder result = new StringBuilder((int) file.length());
|
StringBuilder result = new StringBuilder((int) file.length());
|
||||||
InputStreamReader reader = new InputStreamReader(new FileInputStream(file), "UTF-8");
|
InputStreamReader reader = new InputStreamReader(new FileInputStream(file), "UTF8");
|
||||||
try {
|
try {
|
||||||
char[] buffer = new char[256];
|
char[] buffer = new char[256];
|
||||||
int charsRead;
|
int charsRead;
|
||||||
|
|
Loading…
Reference in a new issue