<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -5,5 +5,6 @@ Makefile
 *.dll
 pkg
 doc
+html
 .DS_Store
 *.log
\ No newline at end of file</diff>
      <filename>.gitignore</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,14 @@
 #include &lt;ruby.h&gt;
 #include &lt;glib.h&gt;
 
+#ifndef RSTRING_LEN
+#define RSTRING_LEN(string) RSTRING(string)-&gt;len
+#endif
+
+#ifndef RSTRING_PTR
+#define RSTRING_PTR(string) RSTRING(string)-&gt;ptr
+#endif
+
 /*
  *  call-seq:
  *    utf8_size(string)
@@ -14,7 +22,7 @@ static VALUE utf8_size(VALUE self, VALUE string)
   VALUE result;
 
   Check_Type(string, T_STRING);
-  result = ULONG2NUM(g_utf8_strlen(StringValuePtr(string), RSTRING(string)-&gt;len));
+  result = ULONG2NUM(g_utf8_strlen(StringValuePtr(string), RSTRING_LEN(string)));
 
   return result;
 }
@@ -33,7 +41,7 @@ static VALUE utf8_upcase(VALUE self, VALUE string)
   gchar *temp;
 
   Check_Type(string, T_STRING);
-  temp = g_utf8_strup(StringValuePtr(string), RSTRING(string)-&gt;len);
+  temp = g_utf8_strup(StringValuePtr(string), RSTRING_LEN(string));
   result = rb_str_new2(temp);
   free(temp);
 
@@ -54,7 +62,7 @@ static VALUE utf8_downcase(VALUE self, VALUE string)
   gchar *temp;
 
   Check_Type(string, T_STRING);
-  temp = g_utf8_strdown(StringValuePtr(string), RSTRING(string)-&gt;len);
+  temp = g_utf8_strdown(StringValuePtr(string), RSTRING_LEN(string));
   result = rb_str_new2(temp);
   free(temp);
 
@@ -75,7 +83,7 @@ static VALUE utf8_reverse(VALUE self, VALUE string)
   gchar *temp;
 
   Check_Type(string, T_STRING);
-  temp = g_utf8_strreverse(StringValuePtr(string), RSTRING(string)-&gt;len);
+  temp = g_utf8_strreverse(StringValuePtr(string), RSTRING_LEN(string));
   result = rb_str_new2(temp);
   free(temp);
 
@@ -114,10 +122,10 @@ static VALUE utf8_normalize(VALUE self, VALUE string, VALUE form)
   } else if (ID2SYM(rb_intern(&quot;kc&quot;)) == form) {
     mode = G_NORMALIZE_NFKC;
   } else {
-    rb_raise(rb_eArgError, &quot;%s is not a valid normalization form, options are: :d, :kd, :c, or :kc&quot;, RSTRING(rb_inspect(form))-&gt;ptr);
+    rb_raise(rb_eArgError, &quot;%s is not a valid normalization form, options are: :d, :kd, :c, or :kc&quot;, RSTRING_PTR(rb_inspect(form)));
   }
 
-  temp = g_utf8_normalize(StringValuePtr(string), RSTRING(string)-&gt;len, mode);
+  temp = g_utf8_normalize(StringValuePtr(string), RSTRING_LEN(string), mode);
   result = rb_str_new2(temp);
   free(temp);
 </diff>
      <filename>ext/glib/glib.c</filename>
    </modified>
    <modified>
      <diff>@@ -9,9 +9,15 @@ class Chars
   alias to_s wrapped_string
   alias to_str wrapped_string
   
-  # Creates a new Chars instance by wrapping _string_.
-  def initialize(string)
-    @wrapped_string = string
+  if 'string'.respond_to?(:force_encoding)
+    # Creates a new Chars instance by wrapping _string_.
+    def initialize(string)
+      @wrapped_string = string.dup.force_encoding(Encoding::UTF_8)
+    end
+  else
+    def initialize(string) #:nodoc:
+      @wrapped_string = string.dup
+    end
   end
   
   # Forward all undefined methods to the wrapped string.
@@ -42,7 +48,7 @@ class Chars
   def &lt;=&gt;(other)
     @wrapped_string &lt;=&gt; other.to_s
   end
-
+  
   # Returns a new Chars object containing the _other_ object concatenated to the string.
   #
   # Example:</diff>
      <filename>lib/chars.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 $:.unshift(File.expand_path('../../../ext/glib', __FILE__))
 $:.unshift(File.expand_path('../../../lib', __FILE__))
 
-$KCODE = 'UTF8'
+$KCODE = 'UTF8' unless 'string'.respond_to?(:encoding)
 
 require 'unichars'
 </diff>
      <filename>test/profile/memory.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,7 +3,7 @@
 $:.unshift(File.expand_path('../../ext/glib', __FILE__))
 $:.unshift(File.expand_path('../../lib', __FILE__))
 
-$KCODE = 'UTF8'
+$KCODE = 'UTF8' unless 'string'.respond_to?(:encoding)
 
 require 'rubygems' rescue LoadError
 require 'test/spec'</diff>
      <filename>test/test_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2bc1506c8a82a4f59216fc4d8ada3d4602f63dad</id>
    </parent>
  </parents>
  <author>
    <name>Manfred Stienstra</name>
    <email>manfred@fngtps.com</email>
  </author>
  <url>http://github.com/Manfred/unichars/commit/674e96ba5d4e0648de8708428330200d426f687a</url>
  <id>674e96ba5d4e0648de8708428330200d426f687a</id>
  <committed-date>2009-07-26T10:08:25-07:00</committed-date>
  <authored-date>2009-07-26T10:08:25-07:00</authored-date>
  <message>Make Unichars compile and run on Ruby 1.9.

I'm not sure why you would want to use Unichars on 1.9 because 1.9's encoding
support is good enough and certainly a lot faster than Unichars.

Tip of the hat to: crishoj.</message>
  <tree>fbcae78d00370bb54665b2042544954326f336c7</tree>
  <committer>
    <name>Manfred Stienstra</name>
    <email>manfred@fngtps.com</email>
  </committer>
</commit>
