Skip to content

Instantly share code, notes, and snippets.

@kaeza kaeza/fwu.py Secret
Created Feb 12, 2017

Embed
What would you like to do?
#! /usr/bin/env python
# :coding=utf-8:
from __future__ import unicode_literals, print_function
__module_name__ = "fwu"
__module_version__ = "0.1.0"
__module_description__ = "Full Width Unicode!"
import xchat
FIRST = 32
LAST = 126
BASE = 0xFF00
try:
unichr
except NameError:
unichr = chr
def fwu(s):
l = [ ]
for ch in s:
cc = ord(ch)
if cc == 32:
cc = 0x3000
elif cc>=FIRST and cc<=LAST:
cc = BASE-FIRST+cc
l.append(unichr(cc))
return "".join(l)
def fwu_command(word, word_eol, userdata):
if len(word) < 2:
print("Usage: "+word[0]+" TEXT")
else:
xchat.command("say "+fwu(word_eol[1]))
xchat.hook_command("fwu", fwu_command)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.