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


in reply to truncate string to byte count

say I have an utf-8 encoded string that I want to truncate to a certain number of bytes.

That's an XY Problem if ever I heard one. What are you really trying to do?