cancel
Showing results for 
Search instead for 
Did you mean: 

Code page conversion

david_fryda2
Participant
0 Kudos

Hi everyone,

I want to translate from code page UTF-8 to code page 1255.

Is there a way to do it in Java ?

I didn't find any class that could do it like in .Net using System.text package.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi David,

Try this code.. Of course change your code page accordingly..


public static void main (String args []) throws Exception {
		try {

			String str="ABC";

			str = new String(str.getBytes("8859_1"),"cp037");
			System.out.println("In EBCDIC :"+str);

			str = new String(str.getBytes("cp037"),"8859_1");
			System.out.println("In ASCII :"+str);


		}
	    catch(Exception e){
		   e.printStackTrace();
		}
	}

Regards,

Ananth

david_fryda2
Participant
0 Kudos

Hi Ananth,

Thanks for the fast reply.

Can you please tell me what are :

8859_1

cp037

Thanks.

Former Member
0 Kudos

Hi David,

8859_1 is for ASCII

and cp037 is for EBCDIC Code page.

The program given in my previous post is a sample code and you have to change it according to your code page.

Regards,

Ananth

david_fryda2
Participant
0 Kudos

THanks a lot Ananth!!!

Nice day.

Answers (0)