Hi,
I'm working in the issue 3943,
http://jira.codehaus.org/browse/JRUBY-3943,"[1.9] IO objects should
use internal encoding to transcode output strings"
but I think I don't understand the behavior of ByteList class.
Actually, what I'm trying to do is to change the RubyString encoding just
before to show it. I'm using the method RubyString#associateEncoding but I
think when I call ByteList.toString() it's not using the encoding set.
I've found a ByteList implementation in this repository :
http://github.com/vvs
http://github.com/vvs/bytelist/blob/ad82ffcdc6ee19ff7d0df2b7f615a5cc97222e50/src/org/jruby/util/ByteList.java
I don't know if this is the official one and actually I don't understand why
this class isn't in the jruby repository, but taking a look to this class I
can see this code:
/**
* Remembers toString value, which is expensive for StringBuffer.
*
* @return an ISO-8859-1 representation of the byte list
*/
public String toString() {
try {
if (stringValue == null) stringValue = new String(bytes,
begin, realSize, "ISO-8859-1");
return stringValue;
} catch (UnsupportedEncodingException uee) {
throw new RuntimeException("ISO-8859-1 encoding should
never fail; report this at www.jruby.org");
}
}
So, when rather than use its encoding variable ISO-8859-1 is hardocoded. Is
this the right repository and the expected behaviour? can I modify it to use
the ByteList#encoding variable?
suggestions to handle this are welcome :)
Cheers