|
|
|
|
|
|
|
|
import com.huntersun.vkyes.etcopencard.src.app.AppActivity; |
|
|
import com.huntersun.vkyes.etcopencard.src.app.AppActivity; |
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException; |
|
|
import java.io.UnsupportedEncodingException; |
|
|
|
|
|
import java.nio.charset.Charset; |
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static String guessEncoding(byte[] bytes) { |
|
|
|
|
|
String[] encodings = {"UTF-8", "GBK", "ISO-8859-1", "GB2312", "UTF-16BE", "UTF-16LE", "UTF-32BE", "UTF-32LE"}; |
|
|
|
|
|
for (String encoding : encodings) { |
|
|
|
|
|
try { |
|
|
|
|
|
String str = new String(bytes, Charset.forName(encoding)); |
|
|
|
|
|
byte[] bytes2 = str.getBytes(Charset.forName(encoding)); |
|
|
|
|
|
if (bytes.length == bytes2.length) { |
|
|
|
|
|
return encoding; |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return null; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static ResultBean.BizContent DecVehInfo(String data) { |
|
|
public static ResultBean.BizContent DecVehInfo(String data) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
byte[] asd = UtilTool.hexStringToByteArray(data); |
|
|
byte[] asd = UtilTool.hexStringToByteArray(data); |
|
|
try { |
|
|
try { |
|
|
str = new String(asd, "GBK"); |
|
|
|
|
|
|
|
|
str = new String(asd, guessEncoding(asd)); |
|
|
} catch (UnsupportedEncodingException e) { |
|
|
} catch (UnsupportedEncodingException e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |