It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming Java Forum

Custom Controls in JAVA

Postby achilles on Wed Apr 25, 2007 3:41 pm

Well, I reverse engineered the I18N algorithms for Decoding URLs and came to this package of mine! Enjoy everybody! this is the concept of OPEN SOURCE!!

Code: Select all
/*
* utf8.java
*
* Created on April 23, 2007, 5:17 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package achilles.util;

import java.io.ByteArrayOutputStream;

/**
*
* @author MMSaffari
*/
public class utf8{
   
    /** Creates a new instance of utf8 */
    public utf8 () {
    }
   
    public static String getUTF8 (String s){
        String strResult="";
        try{
            byte[] b= s.getBytes ();
            ByteArrayOutputStream baos=new ByteArrayOutputStream (s.length ());
            for (int i = 0; i < b.length; i++) {
                baos.write (b[i]);
            }
            byte[] b2=baos.toByteArray ();
            strResult= new String (b2,0,b2.length,"UTF-8");
        } catch (Exception ex){
            ex.printStackTrace ();
        }
       
        return strResult;
    }
}
:)
achilles
 
Posts: 7
Joined: Thu Apr 19, 2007 3:38 pm
Location: Tehran-Iran

Previous

Who is online

Users browsing this forum: No registered users and 0 guests