Package org.unicode

Examples of org.unicode.Normalizer


        // File.toURL() ends up with sth. like "file:/Volumes/Claude/..." omitting the two initial slashes
//        final String[] cmdArray = { "osascript", "-e", "tell application \"Finder\"", "-e", "activate",
//                      "-e", "open location \"" + f.getAbsoluteFile().toURL().toString() + "\"",
//                      "-e", "end tell" };
        // make sure space characters are escaped as %20 in URL stylee
        final Normalizer n    = new Normalizer( Normalizer.C, false );
//        final String parentDir  = n.normalize( f.getParentFile().getAbsolutePath() ).replaceAll( " ", "%20" );
        String path        = n.normalize( f.getParentFile().getAbsoluteFile().toURI().toURL().toExternalForm() ); // getAbsolutePath() ).replaceAll( " ", "%20" );
//        String path        = n.normalize( f.getAbsoluteFile().toURL().toExternalForm() ); // getAbsolutePath() ).replaceAll( " ", "%20" );
        path          = path.substring( 5 );
StringBuffer sb = new StringBuffer();
//char ch;
int  chI;
byte[] hex = "0123456789abcdef".getBytes();
byte[] enc = path.getBytes( "UTF-8" );
for( int i = 0; i < enc.length; i++ ) {
  chI = enc[ i ]; // parentDir.charAt( i );
//  chI = (int) ch;
  if( (chI < 33) || (chI > 127) ) {
    sb.append( "%" + (char) hex[ (chI >> 4) & 0x0F ] + (char) hex[ chI & 0x0F ]);
  } else {
    sb.append( (char) chI );
  }
}
path = sb.toString();
//int i = path.lastIndexOf( '/' ) + 1;
final String parentDir = path;
final String fileName = n.normalize( f.getName() ); // .getBytes( "ISO-8859-1" ));
//final String parentDir = path.substring( 0, i );
//final String fileName = path.substring( i );
//System.err.println( "'" + parentDir + "'" );       
//System.err.println( "'" + fileName + "'" );       
        final String[] cmdArray = { "osascript", "-e", "tell application \"Finder\"", "-e", "activate",
View Full Code Here

TOP

Related Classes of org.unicode.Normalizer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.