| You are here: DEVPPL ‹ Forum ‹ Programming ‹ Java Forum |
NOTIFICATIONS
|
|
|||||||||||||||
Login |
Custom Controls in JAVA
11 posts
• Page 2 of 2 • 1, 2
0
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
- Reputation: 0
- Posts: 7
- Joined: Thu Apr 19, 2007 4:38 pm
- Location: Tehran-Iran
- Highscores: 0
- Arcade winning challenges: 0
|
|