sdl2: update window_handle to support Windows and intro display_handle
[nit.git] / lib / core / codecs / utf8.nit
index c6fc71c..43f6235 100644 (file)
@@ -30,7 +30,7 @@ private class UTF8Codec
        redef fun max_lookahead do return 4
 
        redef fun encode_char(c) do
-               var ns = new NativeString(c.u8char_len)
+               var ns = new CString(c.u8char_len)
                add_char_to(c, ns)
                return ns
        end
@@ -68,12 +68,12 @@ private class UTF8Codec
        end
 
        redef fun decode_string(ns, len) do
-               var ret = ns.to_s_with_length(len)
+               var ret = ns.to_s_unsafe(len, copy=false)
                var rit = ret.as(FlatString).items
                if rit == ns then
-                       var nns = new NativeString(len)
+                       var nns = new CString(len)
                        rit.copy_to(nns, len, 0, 0)
-                       return nns.to_s_full(ret.byte_length, ret.length)
+                       return nns.to_s_unsafe(ret.byte_length, ret.length, copy=false)
                end
                return ret
        end