Quantcast
Channel: Active questions tagged charset - Stack Overflow
Viewing all articles
Browse latest Browse all 63

How to get hex out of the string?

$
0
0

I am reading a text file in Java line by line. For debugging purpose, I would like to get the hex value of the string to check how it is encoded.

For example:

This is my text-file:

äppletree

This is how I read the file:

inputCharset = Charset.forName("ISO-8859-1")BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(fi), inputCharset));while ( in.ready() ) {      String row = in.readLine();      System.out.println(row +" = " + toHex(row));}

The result must be for first line

äpple = E4 70 70 6C 65

How can I convert the chars of the string to the appropriate hex value?


Viewing all articles
Browse latest Browse all 63

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>