How to input Unicde characters in kate or other apps that don't support Ctrl-Shift-u

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
sadhu
Level 5
Level 5
Posts: 643
Joined: Fri Nov 22, 2013 9:48 am
Contact:

How to input Unicde characters in kate or other apps that don't support Ctrl-Shift-u

Post by sadhu »

Kate has not allowed ctrl-shift-u xxxx since at least 2005, according to this. However, I can copy/paste unicode characters into kate. Therefore I followed these instructions to install autokey.

I then created autokey scripts for my various hotkeys, such as Alt-Shift-A which uses the following code to produce capital-A-with-macron (Ā):

Code: Select all

import sys
reload(sys)
sys.setdefaultencoding('utf8')
from subprocess import Popen, PIPE

def paste_character(symbol):
    c = Popen(['xclip', '-selection', 'clipboard'], stdin=PIPE)
    c.communicate(symbol.encode('utf-8')) 
    keyboard.send_keys('<ctrl>+v')

#from MyCopy import paste_character
paste_character('Ā')
The good thing about this method is that it passes the Unicode character through the clipboard, instead of relying on Ctrl-Shift-U, which doesn't always work.

NB: This doesn't work immediately in a terminal. After entering the hotkey, press Ctrl-Shift-v, and the unicode character appears.
sabbe sattā bhavantu sukhitattā. LN 19.3-64 Cinn 4.4.8, Mobo: ASUSTeK STRIX B250G GAMING v, Dual core Pntm G4560, Intel Gfx. Laptop:ASUS, Core i3, 4G RAM Intel Gfx
Post Reply

Return to “Tutorials”