Getting UNICODE codes in string
String prContentFormatHex = ""; for (char c : prContent.toCharArray()) { int code = (int)c; prContentFormatHex += String.format("%04X ", code); }
Getting GSM7 codes (GSM 7-bit default alphabet (Hexadecimal)) in the string. Only for Latin!
Appendix: GSM 7-bit Default Alphabet Table (with Character Codes of ISO 8859 Latin 1)
if (prContentFormatCoding == 0) { //Кодирование для GSM7 for (char c : prContent.toCharArray()) { int code = (int)c; prContentFormatHex += String.format("%X ", code); } }
Examples of displaying strings in UNICODE codes
0048 0069 0020 004D 0079 0020 004E 0061 006D 0065 0020 0049 0073 0020 0053 006C 0069 006D 0020 0053 0068 0061 0064 0079
- In my mouth, feet, quickly!
0412 0020 0440 043E 0442 0020 043C 043D 0435 0020 043D 043E 0433 0438 002C 0020 0431 044B 0441 0442 0440 043E 0021
Examples of displaying strings in GSM7 codes
48 69 20 4D 79 20 4E 61 6D 65 20 49 73