Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'resulting': 0.04; 'string.': 0.05; '(using': 0.07; 'laura': 0.07; 'string': 0.09; 'alternatives': 0.09; 'ascii': 0.09; 'combines': 0.09; 'converts': 0.09; 'creighton': 0.09; 'literal': 0.09; 'modes': 0.09; 'occasionally': 0.09; 'performs': 0.09; 'type,': 0.09; 'url:github': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'backslash': 0.16; 'd),': 0.16; 'dotted': 0.16; 'escapes': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'input:': 0.16; 'mark.': 0.16; 'non-ascii': 0.16; 'script,': 0.16; 'simple.': 0.16; 'subject:virtual': 0.16; 'throw': 0.16; 'usage,': 0.16; 'appropriate': 0.16; 'wrote:': 0.18; 'wed,': 0.18; 'bit': 0.19; 'normally': 0.19; 'feb': 0.22; 'input': 0.22; 'cc:addr:python.org': 0.22; 'instance,': 0.24; 'keyboard': 0.24; 'unicode': 0.24; 'fairly': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'this:': 0.26; '(for': 0.26; 'skip:" 20': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'mode': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "skip:' 10": 0.31; 'usually': 0.31; '(usually': 0.31; 'follows': 0.31; 'produces': 0.31; 'languages': 0.32; 'text': 0.33; 'actual': 0.34; 'table': 0.34; "can't": 0.35; 'received:209.85': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'largely': 0.36; 'ones,': 0.36; 'subject:?': 0.36; 'so,': 0.37; 'received:209': 0.37; 'step': 0.37; 'easiest': 0.38; 'whatever': 0.38; 'rather': 0.38; 'sure': 0.39; 'letters': 0.60; 'skip:2 20': 0.60; 'back': 0.62; 'skip:n 10': 0.64; 'more': 0.64; 'combining': 0.68; '2015': 0.84; 'characters,': 0.84; 'complex,': 0.84; 'elder': 0.84; 'plan:': 0.84; 'serbian': 0.84; 'url:master': 0.84; 'to:none': 0.92; 'url:fr': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type:content-transfer-encoding; bh=V6aMwONZQJHqwiloY7FAkwQnsZHLZWo0ZJDc6GMsmd8=; b=FawnBkZGbxDUJ7IfIAP3/WDEJ12qIZRV/kGXVC6Ap3GpxsU3K/M4sv6+lfk7rllhJc FTJm8rFlj6CLdSSo7MFFgsgui2PAihiawRs1pDwEacPeUO/PZsRaVhvhEy1l0v0o1sYW DGoAfp9c3f/vqv9LTa0/tWRbTLqH4IgoUpZusrLm8WsdKgCejcS6qBCm1YgVYglVfFSp 8iCBg1ITb8lLz1MCmKnkJeBjCzkN6xIWF8BNo44RVpHi9JDO7naS1SYQFhUmhDMDkEEo Fd65haVSRtDPNDwqzuGS7Pks6urd4mQ/LzgQ6+XpRwUpHiuuqyCAl6gLn64Qj+riTEcu uBnA== MIME-Version: 1.0 X-Received: by 10.107.158.146 with SMTP id h140mr34591382ioe.27.1423606364003; Tue, 10 Feb 2015 14:12:44 -0800 (PST) In-Reply-To: <201502102133.t1ALXQ4L021850@fido.openend.se> References: <201502102133.t1ALXQ4L021850@fido.openend.se> Date: Wed, 11 Feb 2015 09:12:43 +1100 Subject: Re: Wildly OT: pop-up virtual keyboard for Mac or Linux? From: Chris Angelico Cc: Python Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 47 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1423606373 news.xs4all.nl 2931 [2001:888:2000:d::a6]:34956 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:85475 On Wed, Feb 11, 2015 at 8:33 AM, Laura Creighton wrote: > I'm using this: > http://michel.staelens.pagesperso-orange.fr/clavier/index_GB.htm# > to get cyrillic. Not sure the other alternatives will get you what > you want -- my keyboard is rather well loaded with accented letters > from the get-go. That looks a lot more general than what I use: https://github.com/Rosuav/shed/blob/master/translit.pike The code's a bit messy, largely because the human languages involved are complex, but broadly, here's the plan: Mode 1: Reversible transliteration. In any of several modes (Cyrillic (Russian, Ukrainian, and Serbian variants), Korean, Elder Futhark, and Greek), it converts the input ASCII text into a non-ASCII script, and back again. Normally I use that to key in text that I can't otherwise type, but I can also copy and paste the other script and check it. Some of them also support diacriticals, as per the other mode. Mode 2: Latin-only mode. Fairly simple: the 'diacriticals' function just transforms some backslash escapes into individual Unicode characters, usually the combining ones, and then performs an NFC normalization on the resulting string. So, for instance (using Python string literal format; in actual usage, these would be single backslashes): Input: "\\!Sue\\'ltalo!" Step 1: "\u00A1Sue\u0301ltalo!" Step 2:"\u00A1Sue\u0301ltalo!" Step 3: "\u00A1Su\u00E9ltalo!" Displayed text: =C2=A1Su=C3=A9ltalo! In usage, it's pretty simple. You key in a letter, then you hit backslash and a (usually mnemonically-appropriate) symbol, and it combines in an appropriate diacritical mark. There are a few oddities in the transformation table (for instance, "i\." produces a dotless i, but "I\." produces a dotted I; and "\-" produces a combining macron, unless it follows a D or d, in which case it produces a crossed D), so if you want to adapt this for your own use, you may want to throw out some of the transformations. But if you only occasionally have need of these kinds of letters, it may be easiest to just keep this handy, key in what you want, and then clipboard it to whatever you want to work with. ChrisA