command-not-found's output get garbled with ja_JP.EUC-jp locale

Bug #161159 reported by supernova
10
Affects Status Importance Assigned to Milestone
command-not-found (Ubuntu)
Fix Released
Undecided
Michael Vogt

Bug Description

% env LANG=ja_JP.EUC-JP /usr/bin/python /usr/lib/command-not-found -- emacs

the command above outputs UTF-8 output. (EUC-JP is correct)

Using lgettext() insterd of gettext() solve the probelem.

--- /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py.orig 2007-09-25 18:41:04.000000000 +0900
+++ /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py 2007-11-09 19:41:21.000000000 +0900
@@ -2,7 +2,7 @@
 # Licensed under GPL, see COPYING for the whole text

 import sys, os, os.path, dbm, posix, grp
-from gettext import gettext as _
+from gettext import lgettext as _

 import apt_pkg
 from aptsources.sourceslist import SourcesList

Revision history for this message
Johnathon (kirrus) wrote :

Bug #161160 duplicate of this report.
Relevant information from that bug:

"This is a patch:
http://www.python.org/doc/2.4.2/lib/node338.html"

Revision history for this message
Johnathon (kirrus) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. Unfortunately we can't fix it, because your description didn't include enough information. You may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html. We'd be grateful if you would then provide a more complete description of the problem.

At a minimum, we need:
1. the specific steps or actions you took that caused you to encounter the problem,
2. the behaviour you expected, and
3. the behaviour you actually encountered (in as much detail as possible).
Thanks!

Changed in command-not-found:
assignee: nobody → kirrus
status: New → Incomplete
Revision history for this message
Johnathon (kirrus) wrote :

We are closing this bug report because it lacks the information we need to investigate the problem, as described in the previous comments. Please reopen it if you can give us the missing information, and don't hesitate to submit bug reports in the future. To reopen the bug report you can click on the current status, under the Status column, and change the Status back to "New". Thanks again!

Changed in command-not-found:
assignee: kirrus → nobody
status: Incomplete → Invalid
Revision history for this message
supernova (hirobo) wrote :

> 1. the specific steps or actions you took that caused you to encounter the problem,
> 3. the behaviour you actually encountered (in as much detail as possible).

ubuntu@ubuntu:~$ LANG=ja_JP.EUC-JP
ubuntu@ubuntu:~$ emacs
??㏍違・??'emacs' ?・札筝?・??宴若吾ц??ゃ??障?:
 * emacs21-nox
 * emacs22-gtk
 * emacs22
 * emacs-snapshot
 * e3
 * emacs-snapshot-nox
 * emacs21
 * emacs22-nox
 * jove
 * ema篏?荅・?・????k
罨<・ : sudo apt-get install <?御?????宴若絃
-bash: emacs: command not found

> 2. the behaviour you expected, and

ubuntu@ubuntu:~$ sudo cp -p /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py{,.orig}
[sudo] password for ubuntu:
ubuntu@ubuntu:~$ sudoedit /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py
ubuntu@ubuntu:~$ diff -u /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py{.orig,}
--- /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py.orig 2007-09-25 18:41:04.000000000 +0900
+++ /usr/share/pycentral/command-not-found/site-packages/CommandNotFound/CommandNotFound.py 2008-02-22 11:02:26.000000000 +0900
@@ -2,7 +2,7 @@
 # Licensed under GPL, see COPYING for the whole text

 import sys, os, os.path, dbm, posix, grp
-from gettext import gettext as _
+from gettext import lgettext as _

 import apt_pkg
 from aptsources.sourceslist import SourcesList
ubuntu@ubuntu:~$ emacs
プログラム 'emacs' は以下のパッケージで見つかりました:
 * emacs21-nox
 * emacs22-gtk
 * emacs22
 * emacs-snapshot
 * e3
 * emacs-snapshot-nox
 * emacs21
 * emacs22-nox
 * jove
 * emacs-snapshot-gtk
次の操作を試してください: sudo apt-get install <選択したパッケージ>
-bash: emacs: command not found

Changed in command-not-found:
status: Invalid → New
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your bugreport.

I'm happy to change this in command-not-found but I wonder if you haven't seen this behavior in a lot of other applications as well?

Changed in command-not-found:
assignee: nobody → mvo
status: New → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package command-not-found - 0.2.15ubuntu1

---------------
command-not-found (0.2.15ubuntu1) hardy; urgency=low

  [ Kjell Braden ]
   * Don't run command-not-found from the shell scripts when it has been
     removed in the meantime (LP: #194939)

  [ Michael Vogt ]
  * CommandNotFound/CommandNotFound.py:
    - do not advise on ".." (LP: # 195090) - thanks to Thomas Perl
    - do not crash on problems with python-apt (LP: #161804)
  * debian/control:
    - improve description (LP: #144153)
  * command-not-found:
    - make the crash message a bit more friendly
  * use lgettext() instead of gettext() (LP: #161159)

 -- Michael Vogt <email address hidden> Fri, 07 Mar 2008 10:01:20 +0100

Changed in command-not-found:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.