[fxruby-users] Unicode support in FXRuby 1.6

Gonzalo Garramuno ggarra at advancedsl.com.ar
Sat Sep 3 04:05:57 EDT 2005

Oh yeah... the plan for ruby2.0 (or 1.9?) Unicode is to have:

so what does this mean for fxruby?

Well, it means that Unicode support could probably be implemented in either
one of two ways:

a) By using FXRuby's own FXString, which would do all the encoding and which
would support a constructor like:
     class FXUnicodeString < String
       def initialize( str, encoding = $KCODE )  # with encoding being ASCII
(latin1, really), Unicode, EJIS or EUC
        # ...etc...
        # ...with all of ruby's standard String methods implemented, using
fox's unicode as the backend.

    # And perhaps... for ease of use...
     class Kernel
          def u(str)
             FXUnicodeString.new(str, 'U')


b) Simply by having a similar text function for the widgets with unicode, so
that, besides:
               text=()   # both returning the string unprocessed.
         there's also
               text(str, encoding)
               text_enc()  # returns [text, encoding]  # if fox remembers
the encoding

Obviously, a) is better as that it would be more similar to what ruby plans
to eventually do with unicode support (and thus, eventually, FXUnicodeString
could just be replaced with ruby's String itself), albeit it may end up
being more work in having to implement all of ruby's methods.

More information about the fxruby-users mailing list