ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: "Dmitry Chistikov" <dd1email@gmail.com>
To: "ALT Linux Community general discussions" <community@lists.altlinux.org>
Subject: [Comm] кодировка man-страниц
Date: Tue, 12 Aug 2008 11:34:49 +0400
Message-ID: <2876aabc0808120034r60e99a41kb60310ca56616486@mail.gmail.com> (raw)

Доброго дня!

Наткнулся на проблему с кодировками в man-страницах. Во многих из них
(возьму для примера basename(1)) используется знак копирайта
(copyright sign). Когда эти страницы, однако, используются программой
man(1), они выводятся как latin1-текст (без преобразования в utf8),
что вызывает некорректное отображение copyright sign в less и
серьезные неудобства при обработке:

$ man basename | grep Copyright
       Copyright � 2006 Free Software Foundation, Inc.
$ man basename | grep Copyright | wc
wc: стандартный ввод:1: Неверный или неполный мультибайтный или широкий знак
      1       6      55
$ man basename | grep Copyright | col -b
       Copyright
$

Перекодировка в utf8, разумеется, помогает:

$ man basename | grep Copyright | iconv -f latin1 -t utf8
       Copyright (c) 2006 Free Software Foundation, Inc.
$ man basename | grep Copyright | iconv -f latin1 -t utf8 | wc
      1       7      56
$ man basename | grep Copyright | iconv -f latin1 -t utf8 | col -b
       Copyright (c) 2006 Free Software Foundation, Inc.
$

В /etc/man.conf по этому поводу написано следующее:

# For use with utf-8, NROFF should be "nroff -mandoc" without -T option.
# (Maybe - but today I need -Tlatin1 to prevent double conversion to utf8.)

Если выкинуть -Tlatin1:

$ diff /etc/man.conf.orig /etc/man.conf
98c98
< NROFF         /usr/bin/nroff -Tlatin1 -mandoc
---
> NROFF         /usr/bin/nroff -mandoc
$

- то проблема действительно исчезает:

$ man basename | grep Copyright
       Copyright (c) 2006 Free Software Foundation, Inc.
$ man basename | grep Copyright | wc
      1       7      56
$ man basename | grep Copyright | col -b
       Copyright (c) 2006 Free Software Foundation, Inc.
$

Однако такой ход приводит к проблемам с русскими manpages, которые,
насколько я понимаю, хранятся в koi8r (пример - vim(1)). В реальности
я русские manpages не использую (так что приведенная правка
/etc/man.conf мне подходит), но это, по-видимому, подход неправильный.
Возможно (задаюсь вопросом после прочтения #9364), стоит все же
переводить man'ы на utf8? Или я не замечаю иного, более правильного
решения?

--
Дмитрий Чистиков,
dd1email at gmail dot com

             reply	other threads:[~2008-08-12  7:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12  7:34 Dmitry Chistikov [this message]
2008-08-12 10:07 ` Андрей Черепанов
2008-08-12 11:17   ` Dmitry Chistikov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2876aabc0808120034r60e99a41kb60310ca56616486@mail.gmail.com \
    --to=dd1email@gmail.com \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git