reencode_string(): introduce and use same_encoding()