# create the encoding routine (only once!) $encode= XML::UM::get_encode(Encoding => 'big5'); ... # convert a utf8 string to the desired encoding $encoded_string= $encode($utf8_string);