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


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

Tests 1 to 11 are incorrect because they don't provide UTF-8. Replace

is truncate_utf8($in, ...), "...";
with
is truncate_utf8(encode_utf8($in), ...), encode_utf8("...");

Replies are listed 'Best First'.
Re^4: truncate string to byte count
by haukex (Archbishop) on Feb 28, 2019 at 21:17 UTC
    Tests 1 to 12 are incorrect because they don't provide UTF-8.

    I think you're making assumptions about what the OP's input data looks like...

    Update:

    Tests 1 to 11 ... Replace ...

    It is uncool to update a node in a way that renders replies confusing or meaningless.

    Update 2: How about "is is uncool to make someone chase down all of your ninja edits and wonder when the ninja editing will be done." You made several other ninja edits (like this one) to your nodes and I had to update my replies several times while composing them.

      No. "say I have an utf-8 encoded string"

      1. There was no reply. 2. Neither noticing that test 12 is an empty string nor adding a bug fix to the bug explanation render the future reply confusing or meaningless.