Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

patch to mask top bit when displaying articles

3 views
Skip to first unread message

G. Paul Ziemba

unread,
Feb 5, 2012, 1:58:55 AM2/5/12
to
I finally got annoyed enough at nn sending my xterm into goofball mode
due to non-ascii characters in posts that I made this quick and dirty
patch to mask off the high bit of characters sent to the terminal.

I'm open to suggestions for a better way to do it.

This patch is based on nn 6.7.3.

put "set term-7bit true" in .nn/init to enable.


--- term.c.orig 2005-06-29 14:40:27.000000000 -0700
+++ term.c 2012-02-04 22:29:13.000000000 -0800
@@ -153,6 +153,7 @@
int mouse_state; /* if xterm is in mouse state */
int mouse_usage; /* 0 don't set mouse, 1 only if xterm, 2 set
* mouse */
+int term_7bit = 0; /* mask top bit when displaying to terminal */

key_type help_key = '?';
key_type comp1_key = SP;
@@ -990,6 +991,9 @@
{
int i;

+ if (term_7bit)
+ c &= 0x7f;
+
#ifdef TERM_DEBUG
if (term_debug) {
fprintf(stderr, "tputc %d %d [%d] ", curxy_c, curxy_l, curxy_nonsp);
--- variable.c.orig 2005-03-30 11:15:31.000000000 -0800
+++ variable.c 2012-02-04 22:31:07.000000000 -0800
@@ -122,7 +122,7 @@
save_report, scroll_clear_page, select_leave_next, select_on_sender,
seq_cross_filtering, shell_restrictions, show_article_date,
show_current_time, show_motd_on_entry, silent, slow_mode,
- suggest_save_file, tidy_newsrc, use_ed_line, use_mail_folders,
+ suggest_save_file, term_7bit, tidy_newsrc, use_ed_line, use_mail_folders,
use_mmdf_folders, use_path_in_from, use_selections, use_visible_bell;

extern int /* integer variables */
@@ -386,6 +386,7 @@
"subject-match-offset", INT 0, (char **) &match_skip_prefix,
"subject-match-parts", BOOL 0, (char **) &match_parts_equal,
"suggest-default-save", BOOL 0, (char **) &suggest_save_file,
+ "term-7bit", BOOL 0, (char **) &term_7bit,
"tidy-newsrc", BOOL 0, (char **) &tidy_newsrc,
"time", BOOL 0, (char **) &show_current_time,
"trace-folder-packing", BOOL 0, (char **) &folder_rewrite_trace,
--
G. Paul Ziemba
FreeBSD unix:
10:56PM up 47 days, 1:17, 20 users, load averages: 0.32, 0.37, 0.35

Aaron W. Hsu

unread,
Aug 4, 2012, 3:46:22 PM8/4/12
to
"G. Paul Ziemba" <paul+...@w6yx.stanford.edu> writes:

>I finally got annoyed enough at nn sending my xterm into goofball mode
>due to non-ascii characters in posts that I made this quick and dirty
>patch to mask off the high bit of characters sent to the terminal.

>I'm open to suggestions for a better way to do it.

NN currently has a setting data-bits which should do what you want. It
also has charset which you might also want to check out.

Me, I got tired of NN not knowing how to handle quoted-printable in
messages, so I have been looking at doing better UTF-8 support. My terminals
all support 8bit characters, so I usually set data-bits to 8 and charset
to utf-8, which NN does not recognize, for now.

--
Aaron W. Hsu | arc...@sacrideo.us | http://www.sacrideo.us
Programming is just another word for the lost art of thinking.
0 new messages