dankogai/p5-encode — pull request #11 by miyagawa (2013-08-26 02:05:55+00:00)
Title: Do not short-circuit decode_utf8 with utf8 flags

THe documentation about `decode_utf8` says:

decode_utf8
$string = decode_utf8($octets [, CHECK]);
Equivalent to "$string = decode("utf8", $octets [, CHECK])".

which is not true, because it bypasses the whole decoding process if `$octet` already has utf-8 flags.

I think it's incorrect to bypass the decoding depending on the utf-8 flags, since a) it will emit unreliable, inconsistent results depending on how the byte string has been generated, and b) it's not consistent to `decode("utf8", $octets)` in any ways.

This patch eliminates the check, and passes all tests.