core :: Codec :: decode_string
b
to UTF-8
# Decodes a string `b` to UTF-8
fun decode_string(b: CString, len: Int): String is abstract
lib/core/codecs/codec_base.nit:65,2--66,60
redef fun decode_string(ns, len) do
assert len >= 0
var ret = ns.to_s_unsafe(len, copy=false)
var rit = ret.as(FlatString).items
if rit == ns then
var nns = new CString(len)
rit.copy_to(nns, len, 0, 0)
return nns.to_s_unsafe(ret.byte_length, ret.length, copy=false)
end
return ret
end
lib/core/codecs/utf8.nit:70,2--80,4