Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: truncate string to byte count

by ikegami (Pope)
on Feb 28, 2019 at 21:13 UTC ( #1230691=note: print w/replies, xml ) Need Help??


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 (Bishop) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1230691]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (3)
As of 2021-02-27 02:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?