#!/usr/bin/perl -W use strict; use warnings; use feature 'say'; use Encode qw(decode encode); use HTML::Entities; my @in = (chr(226).chr(152).chr(134), chr(195).chr(161), chr(150), chr(153), '®', '&', 'Æ', chr(63743), chr(991), chr(9760)); decode_entities($_) for @in; #The below two lines need to be replaced $in[$_] = decode ('utf8', $in[$_]) for 0..1; $in[$_] = decode ('cp1252', $in[$_]) for 2..3; say encode_entities($_) for @in; #### output: ☆ á – ™ ® & Æ  ϟ ☠