$ perl -MEncode=encode,from_to -wle'$s = encode("UTF-8", chr(0x2660)); from_to($s, "UTF-8", "ascii", Encode::FB_XMLCREF); print $s' | od -c 0000000 & # x 2 6 6 0 ; \n 0000011