Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 72792 - nano 1.3.5 has no disabling utf8 option and i get broken input in KOI8-R charset
Summary: nano 1.3.5 has no disabling utf8 option and i get broken input in KOI8-R charset
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: SpanKY
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-28 23:03 UTC by Arthur I.
Modified: 2005-03-21 21:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
PATCH for 'set noutf8' option in nanorc (nano135noutf.patch,5.04 KB, patch)
2004-11-28 23:05 UTC, Arthur I.
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arthur I. 2004-11-28 23:03:48 UTC
nano 1.3.5 has broken KOI8-R support while developers work on utf8
by default when i upgrade nano from 1.3.4 to 1.3.5 throught ebuild --update nano. 

$ locale
LANG=ru_RU.KOI8-R
LC_CTYPE="ru_RU.KOI8-R"
LC_NUMERIC="ru_RU.KOI8-R"
LC_TIME="ru_RU.KOI8-R"
LC_COLLATE="ru_RU.KOI8-R"
LC_MONETARY="ru_RU.KOI8-R"
LC_MESSAGES="ru_RU.KOI8-R"
LC_PAPER="ru_RU.KOI8-R"
LC_NAME="ru_RU.KOI8-R"
LC_ADDRESS="ru_RU.KOI8-R"
LC_TELEPHONE="ru_RU.KOI8-R"
LC_MEASUREMENT="ru_RU.KOI8-R"
LC_IDENTIFICATION="ru_RU.KOI8-R"
LC_ALL=



Reproducible: Always
Steps to Reproduce:
1.update nano
2.start nano
3.type in russian

Actual Results:  
input characters are broken like D21K23 (sounds like utf8)


fast workaround of this problem - $LANG="C" nano

or applied patch by nano-developers maked for me.
this patch adding "set noutf8" option in nanorc and command line option -O
for disabling utf8

diff -ur nano-1.3.5/src/global.c nano-1.3.5-fixed/src/global.c
--- nano-1.3.5/src/global.c	2004-11-22 20:59:18.000000000 -0500
+++ nano-1.3.5-fixed/src/global.c	2004-11-27 12:27:12.000000000 -0500
@@ -1075,15 +1075,17 @@
 #ifndef DISABLE_MOUSE
     toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
 #endif
-    /* If we're using restricted mode, the no-conversion and backup
-     * backup toggles are disabled.  The former is useless since
-     * inserting files is disabled, and the latter is useless since
-     * backups are disabled. */
-    if (!ISSET(RESTRICTED)) {
+    /* If we're using restricted mode, the DOS/Mac conversion toggle is
+     * disabled.  It's useless since inserting files is disabled. */
+    if (!ISSET(RESTRICTED))
 	toggle_init_one(TOGGLE_NOCONVERT_KEY,
 		N_("No conversion from DOS/Mac format"), NO_CONVERT);
+    toggle_init_one(TOGGLE_NOUTF8_KEY,
+	N_("No conversion from UTF-8 format"), NO_UTF8);
+    /* If we're using restricted mode, the backup toggle is disabled.
+     * It's useless since backups are disabled. */
+    if (!ISSET(RESTRICTED))
 	toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), BACKUP_FILE);
-    }
     toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL);
     toggle_init_one(TOGGLE_SMARTHOME_KEY, N_("Smart home key"), SMART_HOME);
 #ifdef ENABLE_COLOR
diff -ur nano-1.3.5/src/nano.c nano-1.3.5-fixed/src/nano.c
--- nano-1.3.5/src/nano.c	2004-11-22 20:59:18.000000000 -0500
+++ nano-1.3.5-fixed/src/nano.c	2004-11-27 12:27:12.000000000 -0500
@@ -787,6 +787,7 @@
 #ifndef NANO_SMALL
     print1opt("-N", "--noconvert", N_("Don't convert files from DOS/Mac format"));
 #endif
+    print1opt("-O", "--noutf8", N_("Don't convert files from UTF-8 format"));
 #ifndef DISABLE_JUSTIFY
     print1opt(_("-Q [str]"), _("--quotestr=[str]"), N_("Quoting string, default
\"> \""));
 #endif
@@ -3250,6 +3251,7 @@
 #endif
 	{"ignorercfiles", 0, 0, 'I'},
 #endif
+	{"noutf8", 0, 0, 'O'},
 #ifndef DISABLE_JUSTIFY
 	{"quotestr", 1, 0, 'Q'},
 #endif
@@ -3313,9 +3315,9 @@
 
     while ((optchr =
 #ifdef HAVE_GETOPT_LONG
-	getopt_long(argc, argv, "h?ABE:FHINQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz",
long_options, NULL)
+	getopt_long(argc, argv, "h?ABE:FHINOQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz",
long_options, NULL)
 #else
-	getopt(argc, argv, "h?ABE:FHINQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz")
+	getopt(argc, argv, "h?ABE:FHINOQ:RST:VY:Zabcdefgijklmo:pr:s:tvwxz")
 #endif
 		) != -1) {
 
@@ -3359,6 +3361,9 @@
 		SET(NO_CONVERT);
 		break;
 #endif
+	    case 'O':
+		SET(NO_UTF8);
+		break;
 #ifndef DISABLE_JUSTIFY
 	    case 'Q':
 		quotestr = mallocstrcpy(quotestr, optarg);
diff -ur nano-1.3.5/src/nano.h nano-1.3.5-fixed/src/nano.h
--- nano-1.3.5/src/nano.h	2004-11-08 23:08:48.000000000 -0500
+++ nano-1.3.5-fixed/src/nano.h	2004-11-27 12:27:12.000000000 -0500
@@ -324,6 +324,7 @@
 #define RESTRICTED		(1<<26)
 #define SMART_HOME		(1<<27)
 #define WHITESPACE_DISPLAY	(1<<28)
+#define NO_UTF8			(1<<29)
 
 /* Control key sequences, changing these would be very very bad. */
 #define NANO_CONTROL_SPACE 0
@@ -508,6 +509,7 @@
 #define TOGGLE_SYNTAX_KEY	NANO_ALT_Y
 #define TOGGLE_SMARTHOME_KEY	NANO_ALT_H
 #define TOGGLE_WHITESPACE_KEY	NANO_ALT_P
+#define TOGGLE_NOUTF8_KEY	NANO_ALT_O
 #endif /* !NANO_SMALL */
 
 #define MAIN_VISIBLE 12
diff -ur nano-1.3.5/src/rcfile.c nano-1.3.5-fixed/src/rcfile.c
--- nano-1.3.5/src/rcfile.c	2004-11-22 20:59:18.000000000 -0500
+++ nano-1.3.5-fixed/src/rcfile.c	2004-11-27 12:27:12.000000000 -0500
@@ -68,6 +68,7 @@
 #endif
     {"nofollow", NOFOLLOW_SYMLINKS},
     {"nohelp", NO_HELP},
+    {"noutf8", NO_UTF8},
 #ifndef DISABLE_WRAPPING
     {"nowrap", NO_WRAP},
 #endif
diff -ur nano-1.3.5/src/winio.c nano-1.3.5-fixed/src/winio.c
--- nano-1.3.5/src/winio.c	2004-11-22 20:59:18.000000000 -0500
+++ nano-1.3.5-fixed/src/winio.c	2004-11-27 12:27:12.000000000 -0500
@@ -221,8 +221,9 @@
 			retval = sequence[0];
 		    }
 		}
-	    /* Handle UTF-8 sequences. */
-	    } else if (seq == UTF8_SEQ) {
+	    /* Handle UTF-8 sequences if UTF-8 conversion isn't
+	     * disabled. */
+	    } else if (!ISSET(NO_UTF8) && seq == UTF8_SEQ) {
 		/* If we have a UTF-8 sequence, translate the UTF-8
 		 * sequence into the corresponding wide character value,
 		 * and save that as the result. */
@@ -263,7 +264,8 @@
 /* Translate acceptable ASCII, extended keypad values, and escape and
  * UTF-8 sequences into their corresponding key values.  Set seq to
  * ESCAPE_SEQ when we get an escape sequence, or UTF8_SEQ when we get a
- * UTF-8 sequence.  Assume nodelay(win) is FALSE. */
+ * UTF-8 sequence (if UTF-8 conversion isn't disabled).  Assume
+ * nodelay(win) is FALSE. */
 int get_translated_kbinput(int kbinput, seq_type *seq
 #ifndef NANO_SMALL
 	, bool reset
@@ -493,8 +495,9 @@
     }
 
     /* A character other than ERR with its high bit set: UTF-8 sequence
-     * mode.  Set seq to UTF8_SEQ. */
-    if (retval != ERR && 127 < retval && retval <= 255)
+     * mode.  Set seq to UTF8_SEQ if UTF-8 conversion isn't disabled. */
+    if (retval != ERR && !ISSET(NO_UTF8) && 127 < retval &&
+	retval <= 255)
 	*seq = UTF8_SEQ;
 
 #ifdef DEBUG




Portage 2.0.51-r3 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0,
2.6.9-gentoo i686)
=================================================================
System uname: 2.6.9-gentoo i686 Intel(R) Pentium(R) 4 CPU 2.80GHz
Unknown Host Operating System
Autoconf: sys-devel/autoconf-2.59-r5
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.92.0.2-r1
Headers:  sys-kernel/linux26-headers-2.6.8.1-r1
Libtools: sys-devel/libtool-1.5.2-r7
ACCEPT_KEYWORDS="x86 ~x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.3/env /usr/kde/3.3/share/config /usr/kde/3.3/shutdown
/usr/kde/3/share/config /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://ftp.rhnet.is/pub/gentoo/ http://ftp.heanet.ie/pub/gentoo/
http://mirror.gentoo.no/ http://mirror.gentoo.ru/pub/mirror/gentoo/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X aalib alsa apm avi berkdb bitmap-fonts cdr crypt cups directfb encode esd
fam flac foomaticdb gdbm ggi gif gnome gphoto2 gpm gtk gtk2 imagemagick imlib
java jpeg kde ldaplibg++ libwww mad mikmod mmx mmx2 motif mozilla mpeg nas
ncurses nls nptl oggvorbis opengl oss pam pdflib perl png python qt readline
samba sdl slang spell sqlite sse sse2 ssl svga tcpd tiff truetype x86 xml xml2
xmms xv zlib"
Comment 1 Arthur I. 2004-11-28 23:05:01 UTC
Created attachment 44912 [details, diff]
PATCH for 'set noutf8' option in nanorc
Comment 2 SpanKY gentoo-dev 2005-03-21 21:56:54 UTC
use nano-1.3.6