CP949 Table in Unicode

CP949 테이블의  문자를 Unicode에 정의된 이름으로 출력해본다.

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
import unicodedata

"""
CP949 table
https://msdn.microsoft.com/en-us/library/cc194942.aspx

the output of this script should have the same as
http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP949.TXT
"""

for lead in range(0x81, 0xF0):
	# these range not exist
	if lead in [0xc1, 0xc2]:
		continue
	for pt in range(0x40, 0xFF+0x1):
		str = ''.join(map(chr, [lead, pt]))
		# print str
		print "# %02x%02x" % (lead, pt),
		try:
			uni = str.decode('cp949')
			text = unicodedata.name(uni)
			print str, text
		except UnicodeDecodeError:
			print "not exist"

생성된 파일은 다음과 같다
cp949.PNG

Happy Coding~:)

 

Advertisements

About rookiecj

Hi all. Today is the day.
This entry was posted in python and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s