function each_utf8(text) local i=1 return function() if i>#text then -- 終了 return end local b=string.byte(text, i) if b==0 then -- eof return elseif b<128 then -- ascii local m=string.sub(text, i, i) i=i+1 return m elseif b<192 then assert(false, 'invalid byte') return elseif b<224 then -- 2bytes local m=string.sub(text, i, i+1) i=i+2 return m elseif b<240 then -- 3bytes(japanese multibyte) local