LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   LANG=fr_FR.utf8 vs. french man pages (http://www.linuxquestions.org/questions/slackware-14/lang%3Dfr_fr-utf8-vs-french-man-pages-4175439691/)

kikinovak 12-02-2012 10:48 AM

LANG=fr_FR.utf8 vs. french man pages
 
Hi,

I'd like to have my Slackware 14.0 system completely in French, including man pages. I have a little problem with these.

Here's what I put in my /etc/profile.d/lang.sh:

Code:

export LANG=fr_FR.utf8
export LC_COLLATE=fr_FR.utf8

And here's /etc/rc.d/rc.font:

Code:

#!/bin/sh
#
# This selects your default screen font from among the ones in
# /usr/share/kbd/consolefonts.
#
setfont -v lat9w-16

A stock Slackware 14.0 system already ships a handful of man pages translated into French, under /usr/man/fr. For example :

Code:

$ man time
Or:

Code:

$ man nmap
Unfortunately, these man pages display the usual suspects of random character soup instead of french special characters like "", "", "", "", and so on.

I have the same problem when I install some external (UTF-8-encoded) french man pages from here: http://manpagesfr.free.fr. So I vaguely guess the problem doesn't originate from the pages themselves.

Hmmm. As is often the case with problems related to encoding, I'm clueless.

NonNonBa 12-02-2012 11:20 AM

Hi,

As usual, there are only awkward solutions. You can edit your /usr/lib/man.conf to force groff to interpret the man-pages as an UTF-8 encoded source (the French man-pages are rendered broken because groff sees them as latin1-encoded):

Code:

NROFF      /usr/bin/groff -K utf8 -mandoc -Tutf8
But then, the man-page encoded in latin(9|1) will be displayed broken. The second solution is to convert the French man-pages into iso-8859-1 using iconv. That's what I used to do when I was installing them (they're not up-to-date anymore, be careful). The conversion works well, except for the pages about the different charsets in 7, but who reads that?

kikinovak 12-02-2012 11:42 AM

Thanks very much! I fiddled around some more and finally managed to get it right. I converted all the man pages to latin1 before installing them, and they display OK now.

Cheers,

Niki

gegechris99 12-02-2012 11:42 AM

I also use "LANG=fr_FR.UTF-8".

With Slackware (and maybe with other distro), it seems that french man pages are shipped in various encodings:

Code:

$ls /usr/man/fr*
/usr/man/fr:
man1  man3  man5  man6        man8

/usr/man/fr.ISO8859-1:
man1

/usr/man/fr.UTF-8:
man1

man pages located in the fr.UTF-8 sub-directory are correctly displayed. For example:

Code:

$man vim
Other pages not stored in this sub-directory won't display correctly most probably because they are not UTF-8 encoded.

So I suspect that you just need additional french man pages encoded in UTF-8 with no need to change any man configuration options.

NonNonBa 12-02-2012 12:57 PM

Quote:

Originally Posted by gegechris99 (Post 4841253)
I also use "LANG=fr_FR.UTF-8".

man pages located in the fr.UTF-8 sub-directory are correctly displayed. For example:

Code:

$man vim
Other pages not stored in this sub-directory won't display correctly most probably because they are not UTF-8 encoded.

So I suspect that you just need additional french man pages encoded in UTF-8 with no need to change any man configuration options.

Nope. :)

vim.1 is correctly displayed because encoded in latin1 and therefore rightly converted in UTF-8 (� means "non-sense in UTF-8"):

Code:

$ zcat /usr/man/fr/man1/vim.1.gz
.br
Cette page de manuel a �t� mise � jour par David Blanchet.
<david.blanchet@free.fr> 2006-04-10.

/usr/man/<local>.<charset> are directories for man-db, not the implementation of man Slackware uses:

Code:

$ man -w vim
/usr/man/fr/man1/vim.1.gz


kikinovak 12-02-2012 01:51 PM

NonNonBa is right. Manpages have to be latin1-encoded to be displayed correctly with french special characters.

gegechris99 12-02-2012 04:35 PM

OK, I was wrong: I was just trying to advance the topic :)

Quote:

Originally Posted by kikinovak (Post 4841252)
I converted all the man pages to latin1 before installing them, and they display OK now.

I'm interested in knowing how you did the conversion to latin1 of existing man pages (ex: nmap). Thank you.

kikinovak 12-02-2012 05:23 PM

Quote:

Originally Posted by gegechris99 (Post 4841381)
I'm interested in knowing how you did the conversion to latin1 of existing man pages (ex: nmap). Thank you.

I didn't. Encoding for this one is still wrong.

Guess I'll have to write a little script that scans /usr/man/fr for UTF-8-encoded pages and automatically converts them to LATIN1.

NonNonBa 12-03-2012 06:30 AM

For the French man-pages archive, there's an option in the configure to perform the conversion. I don't remember if the maintainer had included the other build process I made for man-pages-extras.

For the broken pages of the other packages, there's another solution I haven't thought to:

Code:

$ alias uman='GROFF_ENCODING=utf8 man'
$ uman nmap

Thus, you don't need to touch anything. If a page is rendered broken, just reload it with uman.

kikinovak 12-03-2012 10:33 AM

Quote:

Originally Posted by NonNonBa (Post 4841666)
For the French man-pages archive, there's an option in the configure to perform the conversion. I don't remember if the maintainer had included the other build process I made for man-pages-extras.

For the broken pages of the other packages, there's another solution I haven't thought to:

Code:

$ alias uman='GROFF_ENCODING=utf8 man'
$ uman nmap

Thus, you don't need to touch anything. If a page is rendered broken, just reload it with uman.

This is a GREAT idea. You deserve at least a dozen "found this helpful" clicks for this one.

Thanks a lot!

Didier Spaier 12-03-2012 10:55 AM

IMO the solution proposed by NonNonBa is of course the best one, at least until all man pages in Slackware be shipped in UTF-8 encoding.

@NonNonBa aka Seb: By the way, do you remember your promise to launch the "UTF-8 Slackware" project? ;)

gegechris99 12-03-2012 05:40 PM

Thanks for the tip
 
Quote:

Originally Posted by NonNonBa (Post 4841666)
Code:

$ alias uman='GROFF_ENCODING=utf8 man'
$ uman nmap


Thank you. I'm glad I learned something from my mistake :)

NonNonBa 12-04-2012 12:50 PM

@kikinovak, gegechris99: You're welcome. :hattip:

@Didier Spaier: Yes, I remember I promised a thread. ;)
I wanted to finish the howto about TeX Live first, and caught a nasty little virus in the meanwhile. But I didn't forget, it's in the TODO, don't worry. :)

kikinovak 12-04-2012 02:41 PM

Of course the cleanest solution would be a script that scans everything in /usr/man, hunts down utf8-encoded man pages and converts them to latin1. This is slightly over my scripting abilities, but I've started to experiment nevertheless.

Didier Spaier 12-04-2012 02:50 PM

Quote:

Originally Posted by kikinovak (Post 4842726)
Of course the cleanest solution would be a script that scans everything in /usr/man, hunts down utf8-encoded man pages and converts them to latin1. This is slightly over my scripting abilities, but I've started to experiment nevertheless.

I would certainly prefer the other way round. UTF-8 is the future.


All times are GMT -5. The time now is 07:40 PM.