【发布时间】:2013-06-02 07:36:06
【问题描述】:
我正在尝试从我的 vcard 中解码一个字符串
ADR;WORK;;ENCODING=QUOTED-PRINTABLE:;Building 723 Room 317;;Auckland;;Private Bag 92019 Auckland;New Zealand
转换成标准文本以显示在我的 Android 视图上。我已经使用 vCard 解析器解析了地址字段,使用 http://android-vcard.googlecode.com/hg/examples/ReadExample.java 中的示例。
我已按照here 的建议进行解码:使用codec 库。但是,它仍然将字符串显示为;Building 723 Room 317;;Auckland;;Private Bag 92019 Auckland;New Zealand,而不是对其进行解码。
我的解码代码:
byte[] byteAddress = address.getBytes();
String decodedAddress = "";
try {
decodedAddress = new String(QuotedPrintableCodec.decodeQuotedPrintable(byteAddress));
} catch (DecoderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
TextView textView4 = (TextView) findViewById(R.id.address);
textView4.setText(decodedAddress);
【问题讨论】:
标签: java android decode vcf-vcard