Jun-29-2017, 04:19 AM
they want to have characters with high values (e.g. in the big unicode space) converted to utf-8. they show examples with hexadecimal encoding of integer values for the test characters. so i would just read the input lines as strings, for each line: split the string into parts, find the part that begins with 'U+'. convert what is after that to an int with int(part[2:],16), encode that into utf-8 bytes, convert the bytes into hex, print out the hex appended to the input line.
something like this untested code:
something like this untested code:
for line in sys.stdin: tokens = line.split() for token in tokens: if token[:2].lower() == 'u+': utf8 = chr(int(token[2:],16)).encode() print(line,' '.join([hex(c).replace('x','')[-2:] for c in utf8]).upper())in python3, of course
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.