I having an encoding issue. I have an android application that consists of a text field allowing a user to use a hebrew keyboard and key in hebrew characters.
I wish to encode this data according to the pc862 hebrew code page so that I may send it to a printer for printing (the printer is configured to accept data according to this code page). I should be able to do this with the following code:
String strData = new String(textData);
byte [] rawData = null;
try
{
rawData = strData.getBytes("Cp862"); // Cp862: PC Hebrew
}
catch (UnsupportedEncodingException e)
{
rawData = strData.getBytes();
}
According to the document found here, http://docs.oracle.com/javase/7/docs/technotes/guides/intl/encoding.doc.html
I should be able to encode this code page. However, the code keeps throwing the UnsupportedEncodingException. I am using java se 7 and jre 7, and have imported java.io. I am not sure why this is. I have tried the other code pages on this document and of the ones I have tried, most of them encode correctly.
Do anyone have any ideas what I am doing wrong? Any insight would be much appreciated.