[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Property objects bug fix
Hi all,
Just a quick bug fix:
Setup.java line 164 (inside Object property (String _key, Object _default))
was:
> int byteCount = result.length();
> byte[] bytes = new byte[byteCount];
> for (int i=0; i<byteCount; i++) {
> bytes[i] = (byte)result.charAt (i);
> }
and should be instead:
> byte[] bytes = result.getBytes(); // decode characters
into bytes using the platforms default character encoding
Without this the reading of object properties fails on a mac. When
properties are set, the bytes are converted to chars using the default
encoding (line 148). You need to use the same encoding when changing them
back; you can not just cast.
Note, this fix means that the platform default encoding is used. If you
want to use a specific encoding (and hence make these files more portable)
then you should use: (I've used the "UTF8" encoding here, but any standard
encoding would do.)
instead of the above fix:
> byte[] bytes = result.getBytes("UTF8");
and at line 148:
> setStringProperty (_key, buf.toString("UTF8"));
instead.
later,
\x/ill :-}