On 10 Dec 2005 23:02:58 -0800, "Elhanan" <> wrote,
quoted or indirectly quoted someone who said :
>actually i've just read about a utility in java called native2ascii
Let's look at your *.properties file first.
quoting from
http://mindprod.com/jgloss/properties.html
In contrast to the natively generated system properties, ordinary user
Properties are usually loaded into RAM in their entirety and indexed
for rapid Hashtable access and are later saved to flat files on disk
with the *.properties extension. Properties files on disk are similar
to the old Windows 3.1 INI files, except they have no […] sections.
They are text files encoded with ISO 8859-1 keyword=value pairs. You
can get additional characters with \uxxxx escapes or with \t, \r, \n,
or \f. Comments begin with #. Lines may be continued by ending them in
a trailing \.
NOTE: you must use 8859-1 encoding for your *.properties file. I
don't know if you encode your strings left to right or right to left.
Dump your strings out on the console in hex so you can tell precisely
what you have in each slot.
/** convert a String to a hex representation of the String,
* with 4 hex chars per char of the original String.
* e.g. "1abc \uabcd" gives "0031_0061_0062_0063_0020_abcd"
* @param s String to convert to hex equivalent
*/
public static String displayHexString ( String s )
{
StringBuilder sb = new StringBuilder( s.length() * 5 - 1 );
for ( int i=0; i<s.length(); i++ )
{
char c = s.charAt(i);
if ( i != 0 )
{
sb.append( '_' );
}
// encode 16 bits as four nibbles
sb.append( hexChar [ c >>> 12 & 0xf ] );
sb.append( hexChar [ c >>> 8 & 0xf ] );
sb.append( hexChar [ c >>> 4 & 0xf ] );
sb.append( hexChar [ c & 0xf ] );
}
return sb.toString();
}
// table to convert a nibble to a hex char.
static final char[] hexChar = {
'0' , '1' , '2' , '3' ,
'4' , '5' , '6' , '7' ,
'8' , '9' , 'a' , 'b' ,
'c' , 'd' , 'e' , 'f'};
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.