Attachment 'SjisChars.py'

# -*- coding: cp932 -*-
""" Handle SJIS charcters"""
class SjisChars:
	
	def __init__(self, s):
		self.s = s

	def isKanji():
		return ((0x81 <= self.d <= 0x9F) or (0xE0 <= self.d <= 0xFC))
		isKisyu = (d in (0x87, 0xED, 0xEE, 0xFA, 0xFB, 0xFC))
		isGaiji = (0xF0 <= d <= 0xF9)

	def scan(self):
		a = [c for c in self.s]
		while len(a) > 0:
			c = a.pop(0)
			self.d = ord(c)
			if self.isKanji():
				c += a.pop(0)
			yield c


if __name__ == '__main__':
	sc = SjisChars("abcdŠ¿Žš‡@")
	for c in sc.scan():
		if sc.isKanji():
			print c

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.