+ redef fun to_upper
+ do
+ var outstr = new NativeString(self.bytelen + 1)
+
+ var out_index = 0
+ var index = self.index
+ var ipos = 0
+ var max = length
+
+ while ipos < max do
+ var u = index[ipos].to_upper
+ u.ns.copy_to(outstr, u.len, u.pos, out_index)
+ out_index += u.len
+ ipos += 1
+ end
+
+ outstr[self.bytelen] = '\0'
+
+ return outstr.to_s_with_length(self.bytelen)
+ end
+
+ redef fun to_lower
+ do
+ var outstr = new NativeString(self.bytelen + 1)
+
+ var out_index = 0
+ var index = self.index
+ var ipos = 0
+ var max = length
+
+ while ipos < max do
+ var u = index[ipos].to_lower
+ u.ns.copy_to(outstr, u.len, u.pos, out_index)
+ out_index += u.len
+ ipos += 1
+ end
+
+ outstr[self.bytelen] = '\0'
+
+ return outstr.to_s_with_length(self.bytelen)
+ end
+
+ redef fun output
+ do
+ var i = self.index_from
+ var imax = self.index_to
+ while i <= imax do
+ index[i].output
+ i += 1
+ end
+ end
+
+end
+
+redef class FlatBuffer
+
+ # Fix for this particular implementation
+ #
+ # Since the to_s of a FlatBuffer now builds using
+ # the old String contructor, this breaks everything.
+ #
+ # This will disappear when UTF8 is fully-supported
+ redef fun to_s do
+ written = false
+ return to_cstring.to_s_with_length(length)
+ end