Buffer containing russian Unicode charecters is not cleaning after pressing Backspace
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gnome-terminal (Ubuntu) |
Fix Committed
|
Low
|
Ivan Zuboff |
Bug Description
I'm writing C applications for Ubuntu and I've find out interesting bug. That's a short program showing what's wrong. It reads a line from user and writes that line.
"#include <stdio.h>
void main()
{
char buffer[1024];
for (;;) {
fgets(buffer, sizeof buffer-1, stdin);
printf("%s\n", buffer);
}
}"
When I'm using a gnome-terminal with UTF-8 encoding, if I write in this program a string "Hello!", then delete it all with Backspace, than press Enter, I'll see: program have red an empty string, as expected. Then I write "123", delete it, press Enter and see: program have red an empty string, as expected.
But if I write a string on russian, for example "Привет!", delete it all and press Enter, i'll see that program had red a string "Пр". If after full deletion of "Привет!" I write a string "123", it will show "При123". And this problem is happening with any Unicode russian string, that need to be edited, even if you want to replace only one symbol: say, I'm enter "Привед", delete one character and press "т" to change it to "Привет" - than program says it red a string "Приве�т". There's no such problems if I enter strings which contain only english letters and/or numbers.
There's no such problem if I use any other encoding, which can be selected in gnome-terminal menu: KOI8R, WINDOWS1251, ISO-8859-5. I didn't noticed such problem on both XTerm an UXTerm, probably because they're don't using Unicode; there's also no such problem on LXTerminal, XTerm and UXTerm on my other machine running Lubuntu, probably by the same reason.
Thanks you very much in advance for any efforts to solve this issue.
System info:
> lsb_release -rd
Description: Ubuntu 14.04.1 LTS
Release: 14.04
> apt-cache policy gnome-terminal
gnome-terminal:
Установлен (Installed): 3.6.2-0ubuntu1
Кандидат (Candidate): 3.6.2-0ubuntu1
Таблица версий (Table of versions):
*** 3.6.2-0ubuntu1 0
500 http://
100 /var/lib/
ProblemType: Bug
DistroRelease: Ubuntu 14.04
Package: gnome-terminal 3.6.2-0ubuntu1
ProcVersionSign
Uname: Linux 3.13.0-34-generic i686
ApportVersion: 2.14.1-0ubuntu3.3
Architecture: i386
CurrentDesktop: Unity
Date: Fri Aug 22 22:37:38 2014
ExecutablePath: /usr/bin/
InstallationDate: Installed on 2014-04-19 (124 days ago)
InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release i386 (20140417)
ProcEnviron:
LANGUAGE=ru
PATH=(custom, no user)
XDG_RUNTIME_
LANG=ru_RU.UTF-8
SHELL=/bin/bash
SourcePackage: gnome-terminal
UpgradeStatus: No upgrade log present (probably fresh install)
Changed in gnome-terminal (Ubuntu): | |
importance: | Undecided → Low |
If you're using UTF-8 character set, you need to execute "stty iutf8", so that a "stty -a" reports back "iutf8".
For non-UTF-8, the command to be executed is "stty -iutf8" and accordingly "stty -a" should report "-iutf8".
Gnome-terminal sets this according to the initial character set of the terminal, but does not (could not reliably) update this if switching encoding later. I assume your profile is set to KOI8-R by default and switch to UTF-8 during runtime, is that correct?
Please try what happens if your profile is configured to have UTF-8 by default. It should work out of the box then.