#conver gbk to unicode
gbk1='我们' #a gbk string print'gbk sting: ',gbk1
uni1=unicode(gbk1,'gbk') #conver to unicode str print'uni sting: ',uni1
#form a string form gbk code or unicode
str1='\u6211\u4eec' #unicode code of us
uni2=unicode(str1,'unicode-escape') print'uni sting form uni code: ',uni2
str2='\xce\xd2\xc3\xc7' #gbkcode of us
uni3=unicode(str2,'gbk') print'uni sting form gbk code: ',uni3
#--------------------------------------- print"print unicode 0x6211 to 0x6221"
for i in range(0x6211,0x6221):
j='\u'+hex(i)[2:6]
k=unicode(j,'unicode-escape') print j,': ',k
#----------------------------------------- print"print c1xx area gbk code" for i in range(0x4,0x10): for j in range(0,0x10):
gbk3='\xc1'+chr((i<<4)+j) print gbk3,
#uni4=unicode(gbk3,'gbk')
#print gbk3+': '+uni4+' ', print'\n'