Monday, August 16, 2010

Convert int to Extended ASCII

In my old exercise "ListView with more items on each entry, using SimpleAdapter", convertion of int to ASCII have been introduced:

//i is the int to be converted
byte[] data = {(byte) i};
CharSequence strSymbol = EncodingUtils.getAsciiString(data);



The follwing code show how to convert from int (0x80~0xFF) to extended ASCII of charset "windows-1252", using org.apache.http.util.EncodingUtils.

//i is the int to be converted
byte[] data = {(byte) i};
CharSequence strSymbol = EncodingUtils.getString(data, "windows-1252");





No comments:

Post a Comment