See also
and also
Testing atom_codes(_,_)
Unit test code is here test_atom_codes.pl
Addendum
Morph character codes to hex (with_output_to/2 is SWI-Prolog specific)
?- atom_codes('アイウエオ',Katakana), maplist( ([Num,Out]>>with_output_to(string(Out),format("0x~16R",[Num]))), Katakana, OutColl). Katakana = [12450, 12452, 12454, 12456, 12458], OutColl = ["0x30A2", "0x30A4", "0x30A6", "0x30A8", "0x30AA"].
Morph them to UTF-8
atom_codes('アイウエオ',KatakanaUCS2), phrase(utf8_codes(KatakanaUCS2),KatakanaUTF8), maplist( ([Num,Out]>>with_output_to(string(Out),format("0x~16R",[Num]))), KatakanaUTF8, OutColl). KatakanaUCS2 = [12450,12452,12454,12456,12458], KatakanaUTF8 = [227,130,162,227,130,164,227,130,166,227,130,168,227,130,170], OutColl = [0xE3,0x82,0xA2,0xE3,0x82,0xA4,0xE3,0x82,0xA6,0xE3,0x82,0xA8,0xE3,0x82,0xAA].