From owner-svn-src-all@freebsd.org Sun Nov 4 16:58:56 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7225610DCC6F; Sun, 4 Nov 2018 16:58:56 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0080379EEC; Sun, 4 Nov 2018 16:58:56 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5BB63891; Sun, 4 Nov 2018 16:58:55 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA4GwtKt031288; Sun, 4 Nov 2018 16:58:55 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA4Gwt30031287; Sun, 4 Nov 2018 16:58:55 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201811041658.wA4Gwt30031287@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sun, 4 Nov 2018 16:58:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r340128 - head/usr.bin/man X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/usr.bin/man X-SVN-Commit-Revision: 340128 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0080379EEC X-Spamd-Result: default: False [-0.26 / 200.00]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-0.15)[-0.146,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Nov 2018 16:58:56 -0000 Author: yuripv Date: Sun Nov 4 16:58:55 2018 New Revision: 340128 URL: https://svnweb.freebsd.org/changeset/base/340128 Log: Teach man(1) about C.UTF-8. While here, use LANG as the proper source to select man pages language/encoding, falling back to LC_CTYPE. Reviewed by: bapt Approved by: kib (mentor, implicit) Differential Revision: https://reviews.freebsd.org/D17835 Modified: head/usr.bin/man/man.sh Modified: head/usr.bin/man/man.sh ============================================================================== --- head/usr.bin/man/man.sh Sun Nov 4 16:08:59 2018 (r340127) +++ head/usr.bin/man/man.sh Sun Nov 4 16:58:55 2018 (r340128) @@ -662,6 +662,7 @@ man_setup_width() { # Setup necessary locale variables. man_setup_locale() { local lang_cc + local locstr locpaths='.' man_charset='US-ASCII' @@ -670,18 +671,25 @@ man_setup_locale() { if [ -n "$oflag" ]; then decho 'Using non-localized manpages' else - # Use the locale tool to give us the proper LC_CTYPE + # Use the locale tool to give us proper locale information eval $( $LOCALE ) - case "$LC_CTYPE" in + if [ -n "$LANG" ]; then + locstr=$LANG + else + locstr=$LC_CTYPE + fi + + case "$locstr" in C) ;; + C.UTF-8) ;; POSIX) ;; [a-z][a-z]_[A-Z][A-Z]\.*) - lang_cc="${LC_CTYPE%.*}" - man_lang="${LC_CTYPE%_*}" + lang_cc="${locstr%.*}" + man_lang="${locstr%_*}" man_country="${lang_cc#*_}" - man_charset="${LC_CTYPE#*.}" - locpaths="$LC_CTYPE" + man_charset="${locstr#*.}" + locpaths="$locstr" locpaths="$locpaths:$man_lang.$man_charset" if [ "$man_lang" != "en" ]; then locpaths="$locpaths:en.$man_charset"