http://qs321.pair.com?node_id=1230686


in reply to Re: truncate string to byte count
in thread truncate string to byte count

This utf8cut is buggy. It can give suffers from The Unicode Bug. It's output is dependent on how a string is stored internally, which is a bug.

For example, passing a string consisting of characters 80 and 80 with a second argument of 2 will can result in "\x80" (correct) and "\x80\x80" (incorrect).