Enjoy.

> Joel can I get a copy of that hex convert utility too? I am working on a
> Korean version of mysql yet I currently speak only english. That utility
> would help me gobbs. 
> 
> -----Original Message-----
> From: Joel Rees [mailto:[EMAIL PROTECTED]]
> Sent: Sunday, September 29, 2002 8:24 PM
> To: Dawn Friedland
> Cc: [EMAIL PROTECTED]
> Subject: Re: Japanese Charset
...
> Say, do you want a little utility program in Java or C that will print
> the hexadecimal values of the characters in a string? Basically, it
> would be a command-line utility, so you would copy the text and then
> paste it into the command line, after the name of the utility. You'd
> need a compiler, of course. 

The C would be even more transparent. But I don't have a C compiler
loaded right now. Besides, Java is so international.

----------------------------source---------------------------
/**
 * Get a look at the numeric values of characters.
 *
 * Use from the command line as (for example):
 * C:> java ShowHex <paste or type strings here>
 *
 * @author Joel Rees, Altech Corporation, Esaka, Japan
 *         Copyright September 2002
 *         May be copied, modified, and otherwise used freely.
 *         (I mean, really, this isn't very long or complicated. 8-)
 *         No warranty. Use at your own risk.
 *
 * @version 0.1
 *         Works in Java 1.4.
 */


import java.lang.Class;
import java.lang.Byte;


public class ShowHex 
{
        public static void main( String[] args )
        {       if ( args.length < 1 )
                {
                        System.out.println( "Usage: " 
                                + ShowHex.class.getName() /* Okay, this is ridiculous. 
*/
                                + " <string> [, <string> ... ]" );
                }
                else
                {
                        for ( int arg = 0; arg < args.length; ++arg )
                        {
                                String input = new String( args[ arg ] );
                                byte[] myBytes = args[ arg ].getBytes();
                                System.out.println( input );
                                for ( int i = 0; i < myBytes.length; ++i )
                                {
                                        System.out.print( Integer.toHexString( ( 
myBytes[ i ] & 0xff ) ) );
                                        if ( i < ( myBytes.length - 1 ) )
                                        {       System.out.print( ' ' );
                                        }
                                }
                                System.out.println();
                        }
                }
        }

}


-- 
Joel Rees <[EMAIL PROTECTED]>


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to