From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <3C10B445.FB43FC8B@strakt.com> From: Boyd Roberts MIME-Version: 1.0 To: "9fans@cse.psu.edu" <9fans@cse.psu.edu> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [9fans] libXg/rune.c for latin-1 Date: Fri, 7 Dec 2001 13:21:25 +0100 Topicbox-Message-UUID: 30fd7dea-eaca-11e9-9e20-41e7f4b1d025 For those of us who use sam [on unix] in latin-1 environments UTF is a real problem. Yes, I'd like to use Plan 9 UTF everywhere, but it's not really an option given I edit everything with sam and smashing latin-1 files is not an option. What follows is the least odious hack (tm) for pure unix environments; it's pretty much a compile time decision. Recall that both sam and samterm use Runes and adding extra command line options or changing the sam/samterm protocol are much worse options. I could have played tricks with the Rune constants, but I thought that would just degrade the code, confuse the issue and generally mess things up, so I added a very visually obvious #define: % diff -e libXg/OLDrune.c libXg/rune.c 204c if(LATIN_1_OK(c) || c < Runeself) { . 173c if(LATIN_1_OK(c) || c < Runesync) /* not part of utf sequence */ . 157c if(LATIN_1_OK(c) || c < Tx) . 139c if(LATIN_1_OK(c) || c <= Rune1) . 96c if(LATIN_1_OK(c) || c <= Rune1) { . 41c if(LATIN_1_OK(c) || c < Tx) { . 5a #define LATIN_1_OK(c) ((c) <= 0xFF) .