๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.games.microprose.transport-tyc
Article #28529

Unicode text input support, was: 2.0.1 alpha 73

#28529
From: Marcin Grzegorczyk
Date: Thu, 16 Feb 2006 13:30
39 lines
3547 bytes
Daan wrote:
> Josef Drexler wrote:
>> That's really the only place it matters.  I'm not sure how to design it
>> though.  In Linux I create my non-standard characters with the "combine"
>> key, e.g. the sequence <combine " a> becomes รค.  Something like that
>> would be workable, but won't support all needed characters.
> 
> Ehh? this works already like that in the windows version on winxp? If I 
> type "+A I get รค in ttdpatch. Or do you want to make it work like that 
> for the dos version of the patch?

There are several separate issues here.

For the Windows version, the Windows keyboard driver takes care of 
converting key combinations to characters.  However, TTD uses 
byte-oriented Win32 API, so it always gets characters in the active 
Windows code page (which supports only a limited set of characters and, 
depending on what the active code page is, may be slightly or radically 
different from what TTD displays).  Fixing this shouldn't be hard in 
principle -- just use Unicode API instead, and convert to single bytes 
(or UTF-8) as necessary.  What may be messy is text input, since we need 
a way to avoid mixing TTD's native code page with UTF-8.

For the DOS version, the problem is completely different, since DOS TTD 
handles keyboard itself at a very low level.  I think the only 
reasonable solution is to rewrite the existing TTDPatch's keyboard 
handler extension (probably replacing the original handler entirely), 
add Unicode support to ttdpatch.kbd and store the last pressed key's 
Unicode character separately from the one-byte character (the former 
would be accessed only by the text input field; also, I guess we could 
use some otherwise-unused code in the range 0x01..0x1F to signal an 
unmappable Unicode character to the byte-oriented code).  The need to 
avoid mixing UTF-8 with pre-existing native strings is the same here.

The 'combine' solution could be a later addition to this model, but 
AFAIK the key-combo input method tends to be more common, so it should 
be supported first.  (It's also easier to support IMHO, as it's stateless.)
-- 
Marcin Grzegorczyk
Technical Details
Message-ID: <dt1unk$hfq$1@server.our.house>
Path: mbox-mo1.pugleaf.net!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.maxwell.syr.edu!news-rtr.nyroc.rr.com!news-out.nyroc.rr.com!twister.nyroc.rr.com.POSTED!53ab2750!not-for-mail
References: <pan.2006.02.14.02.59.14.372515@joesbox.cjb.net> <dsvd9r$h6g$1@server.our.house> <pan.2006.02.16.02.37.44.184287@joesbox.cjb.net> <43f456b7$0$718$5fc3050@dreader2.news.tiscali.nl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!number1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.maxwell.syr.edu!news-rtr.nyroc.rr.com!news-out.nyroc.rr.com!twister.nyroc.rr.com.POSTED!53ab2750!not-for-mail
From: Marcin Grzegorczyk <mgrzegor@poczta.onet.pl>
Newsgroups: alt.games.microprose.transport-tyc
Subject: Unicode text input support, was: 2.0.1 alpha 73
Organization: None apparently.
Lines: 39
Message-ID: <dt1unk$hfq$1@server.our.house>
References: <pan.2006.02.14.02.59.14.372515@joesbox.cjb.net> <dsvd9r$h6g$1@server.our.house> <pan.2006.02.16.02.37.44.184287@joesbox.cjb.net> <43f456b7$0$718$5fc3050@dreader2.news.tiscali.nl>
X-Orig-NNTP-Posting-Host: k314-1.iios.pwr.wroc.pl
Mime-Version: 1.0
X-Orig-X-Trace: server.our.house 1140096564 17914 156.17.36.219 (16 Feb 2006 13:29:24 GMT)
X-Orig-Complaints-To: abuse@joesbox.cjb.net
X-Orig-NNTP-Posting-Date: 16 Feb 2006 13:29:24 GMT
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.11) Gecko/20050728
X-Accept-Language: en, pl, cs, sk, de
In-Reply-To: <43f456b7$0$718$5fc3050@dreader2.news.tiscali.nl>
Date: Thu, 16 Feb 2006 13:30:06 GMT
NNTP-Posting-Host: 24.58.1.5
X-Complaints-To: abuse@rr.com
X-Trace: twister.nyroc.rr.com 1140096606 24.58.1.5 (Thu, 16 Feb 2006 08:30:06 EST)
NNTP-Posting-Date: Thu, 16 Feb 2006 08:30:06 EST
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit