It's not clear what you want.
utf8::downgrade switches from bytes internally encoded as UTF-8 to just bytes.
$ perl -MDevel::Peek -e'utf8::upgrade $x="\200\201"; Dump $x; utf8::do +wngrade $x; Dump $x' PV = 0x81623f0 [UTF8 "\x{80}\x{81}"] PV = 0x81623f0 "\200\201"\0
utf8::encode will re-encode the data that has been decoded from UTF-8.
$ perl -MDevel::Peek -e'utf8::decode $x="\x{2660}"; Dump $x; utf8::enc +ode $x; Dump $x' PV = 0x81651c0 [UTF8 "\x{2660}"] PV = 0x81651c0 "\342\231\240"\0
If it's truly an incorrectly set flag, there's also Encode::_utf8_off. It should only be used if the above two don't work.
$ perl -MDevel::Peek -MEncode=_utf8_on,_utf8_off -e'_utf8_on( $x="\200 +\201" ); Dump $x; _utf8_off $x; Dump $x' PV = 0x81651e8 [UTF8 "\x{1}@"] PV = 0x81651e8 "\200\201"\0
References:
utf8 (You don't need to load the module to use its subs.)
Encode
Update: Added code.
In reply to Re: deal with incorrectly set utf8 flag
by ikegami
in thread deal with incorrectly set utf8 flag
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |