Skip to content Skip to sidebar Skip to footer

How To Convert Special Characters To Hex? ( In Android )

Convert some special characters into hex value. For example : Hex value of 'ㅂ' is 'e3 85 82' Hex value of 'ㅈ', 'ㄷ', and 'ㄱ' are 'e3 85 88', 'e3 84 b7', and 'e3 84 b1' re

Solution 1:

Your answer encoding is in UNICODE(hex) and you need to convert it into UTF8(hex)

Convert String to hex.

publicstaticvoid main(String[] args) throws UnsupportedEncodingException {
    String chr = "ㅂ";
    System.out.print(toHex(chr));
}
//String to hexpublicstaticString toHex(String arg) throws UnsupportedEncodingException {
    //Change encoding according to your need returnString.format("%04x", new BigInteger(1, arg.getBytes("UTF8")));
}

Output:- e38582

Post a Comment for "How To Convert Special Characters To Hex? ( In Android )"