5 Replies Latest reply: Apr 11, 2014 9:52 AM by rp0428 RSS

    program to convert utf-8 to cp1251 format




      I am trying to covert utf-8 encoding into CP1251 encoding. But i am getting null pointer exception. Can somebody help


      package ProcessDefinition;
      import java.util.*;
      import java.io.*;
      import java.lang.String;
      public class ProcessDefinitionJavaCode{
      /****** START SET/GET METHOD, DO NOT MODIFY *****/
         protected String[] in_var_1 = null;
         protected String[] out_var_1 = null;
         public String[] getin_var_1() {
            return in_var_1;
         public void setin_var_1(String[] val) {
            in_var_1 = val;
         public String[] getout_var_1() {
            return out_var_1;
         public void setout_var_1(String[] val) {
            out_var_1 = val;
      /****** END SET/GET METHOD, DO NOT MODIFY *****/
         public ProcessDefinitionJavaCode() {
         public void invoke() throws Exception {
      /* Available Variables: DO NOT MODIFY
         In  : String[] in_var_1
         Out : String[] out_var_1
      * Available Variables: DO NOT MODIFY *****/

      int i;

      byte[] byteInCP= new byte[100];
      System.out.println("Hi I am in loop");
      byteInCP = in_var_1[i].getBytes("CP1251");
      String temp=new String(byteInCP);
      out_var_1[i]= temp;
      System.out.println("Hi I am out of loop");