summaryrefslogtreecommitdiffstats
path: root/modules/codepoints.py
diff options
context:
space:
mode:
authorSean B. Palmer <http://inamidst.com/sbp/>2008-02-29 15:36:18 +0000
committerSean B. Palmer <http://inamidst.com/sbp/>2008-02-29 15:36:18 +0000
commit3d920f431789ac53596933785b5fe61463335e3b (patch)
tree654b01dfb141aba551d400393263fa6914ba9310 /modules/codepoints.py
parentcbdf9ebd7312bf570a212057ad793ae520bac38f (diff)
downloadbot-3d920f431789ac53596933785b5fe61463335e3b.tar.gz
bot-3d920f431789ac53596933785b5fe61463335e3b.tar.bz2
bot-3d920f431789ac53596933785b5fe61463335e3b.zip
Some more little fixes, and added a Makefile.
Diffstat (limited to 'modules/codepoints.py')
-rw-r--r--modules/codepoints.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/modules/codepoints.py b/modules/codepoints.py
index 83425c5..d966670 100644
--- a/modules/codepoints.py
+++ b/modules/codepoints.py
@@ -21,7 +21,8 @@ def about(u, cp=None, name=None):
def codepoint_simple(arg):
arg = arg.upper()
- r_label = re.compile('\\b' + arg.replace(' ', '.*\\b'))
+
+ r_label = re.compile('\\b' + arg.replace(' ', '.*\\b') + '\\b')
results = []
for cp in xrange(0xFFFF):
@@ -32,6 +33,16 @@ def codepoint_simple(arg):
if r_label.search(name):
results.append((len(name), u, cp, name))
if not results:
+ r_label = re.compile('\\b' + arg.replace(' ', '.*\\b'))
+ for cp in xrange(0xFFFF):
+ u = unichr(cp)
+ try: name = unicodedata.name(u)
+ except ValueError: continue
+
+ if r_label.search(name):
+ results.append((len(name), u, cp, name))
+
+ if not results:
return None
length, u, cp, name = sorted(results)[0]