Re: Question of UTF16BE encoding / decoding

2009-05-05 Thread Napalmski
In article , metolone+gm...@gmail.com says... > > > import binascii > s = '004e006100700061006c006d' > h = binascii.unhexlify(s) > print h.decode('utf-16-be') > > -Mark And: name2 = name2.encode("utf-16-be") print binascii.b2a_hex(name2) to re-encode, Thank you, much appreciated! -- http://m

Re: Question of UTF16BE encoding / decoding

2009-05-04 Thread Mark Tolonen
"Napalmski" wrote in message news:mpg.2469d7edf8bbcd0a989...@eu.news.astraweb.com... Hello, I have an encoded string in the form "004e006100700061006c006d", if you split on every 4 characters it decodes to a single character. I have come up with this: name = '004e006100700061006c006d' name2

Question of UTF16BE encoding / decoding

2009-05-04 Thread Napalmski
Hello, I have an encoded string in the form "004e006100700061006c006d", if you split on every 4 characters it decodes to a single character. I have come up with this: name = '004e006100700061006c006d' name2 = "" for x in range(0, len(name), 4): name2 = name2 + chr(int(name[x:x+4], 16)) Is t