On 6/27/06, Michal Suchanek <hramrach / centrum.cz> wrote:
> On 6/26/06, Charles O Nutter <headius / headius.com> wrote:
>> On 6/26/06, Austin Ziegler <halostatue / gmail.com> wrote:
>>> So does the coersion proposal that I've made without locking
>>> ourselves into Unicode. If I have a thousand files that are
>>> Mojikyo-encoded, it becomes very inefficient for me to work with it
>>> in Unicode and far easier to work with Mojikyo directly.
>> Perhaps this debate should be weighing those encodings that could not
>> reasonably (or perhaps, easily) be represented in a pure-unicode
>> String versus those that could. Would it be reasonable to say that if
>> 90% of Ruby users would never have a pressing need for a
>> non-unicode-encodable String, then an uber-String that's entirely
>> encoding-agnostic would be better written as an extension for those
>> special cases? Do we really need to encumber all of Ruby for the
>> needs of a relative few?
> Its' been asked already.
>
> Again: How does the possibility to store non-unicode characters in
> strings encumber you?

To be fair to Charles, he would benefit immensely from a Unicode
internal representation because he could then simply *and cleanly* use
Java Strings as Ruby Strings in JRuby.

With an m17n String, he will need to have something else that isn't
compatible with Java Strings, which hurts JRuby's use as a Java glue
language. I think that there are ways around this. Maybe make the JRuby
String class have an internal something like:

  class JRuby.String
  {
	private Java.Lang.String	unicode;
	private ByteVector			m17n;
	private Java.Lang.String	encoding;
	private bool				isUnicode;
  }

That way, if it's a Unicode encoding -- regardless of what's desired --
he could use the unicode member; otherwise internally he uses the
ByteVector. (Strictly speaking, for non-"raw" or "binary" encodings, he
could always use the unicode member and convert as necessary.)

-austin
-- 
Austin Ziegler * halostatue / gmail.com * http://www.halostatue.ca/
               * austin / halostatue.ca * http://www.halostatue.ca/feed/
               * austin / zieglers.ca