Hi,
here im trying to read a thai charecters from a text file and creating a pdf with iText.
1.thaidata.txt contains the original source file.
  when i convert the bytes which i read from source text file into String using the PdfEncodings with different encoding like
as Cp1252,PDF,"".it gerates the following outut file.all are not ok with the source file content.
 
2.thaidata-Cp1252.txt
3.thaidata-PDF.txt
4.thaidata-null.txt
 
    public static void getThaiFileData()
    throws FileNotFoundException
    {
 try
 {
     FileInputStream fis = new FileInputStream(new File("c:\\temp\\thaidata.txt"));
     System.out.println(fis.available());
 
     byte[] b = new byte[4000];
     fis.read( b);
       FileOutputStream foss = new FileOutputStream( "c:\\temp\\thaidataPDF.txt");
       PdfEncodings  pfd=new PdfEncodings();
       line=pfd.convertToString(b,"");
       foss.write(line.getBytes());
 } catch(FileNotFoundException e)
 {
     throw e;
 }
 catch(IOException eio)
 {
     eio.printStackTrace();
 }
    }
   
 
   Can you please look into it and help me.
 
Thanks with best regards,
K.Krishna Kumar
this is the thai test        ะรห รห ะ ะหะ �?ฎพ ะ�?ร 
ฆ�?ะ�? ฆรหยส�?ั รื ระ�?ะยฆ�? ะพำ รห 
หฎชำ อ�?พร�?ะรฎืห รื ำๆฎฆรื๕ๅ 
this is the thai test        ะรห รห ะ ะหะ ดนพ ะฟร 
�?ฟะฟ �?รหยสฟั รื ระปะย�?ด ะพำ รห 
หนทำ อฟพรฟะรนืห รื ำ�?น�?รืเใ 
this is the thai test        ะรห รห ะ ะหะ �?�?�? ะ�?ร 
�?�?ะ�? �?รหยส�?ั รื ระ�?ะย�?�? ะ�?ำ รห 
ห�?�?ำ อ�?�?ร�?ะร�?ืห รื ำ�?�?�?รื�?�? 
this is the thai test        ะรห รห ะ ะหะ ดนพ ะฟร 
กฟะฟ กรหยสฟั รื ระปะยกด ะพำ รห 
หนทำ อฟพรฟะรนืห รื ำแนกรืเใ 


Reply via email to