Bug 196286

Summary: utf-8 variants of libc.cat missing
Product: Base System Reporter: eserte12
Component: confAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Some People    
Priority: ---    
Version: 10.1-RELEASE   
Hardware: Any   
OS: Any   

Description eserte12 2014-12-26 19:20:25 UTC
There are UTF-8 variants of /usr/share/nls/*/libc.cat for European languages, which is a little bit surprising when switching locale from ISO885-X to UTF-8:

$ cat locale.c 
#include <locale.h>
#include <stdio.h>
#include <string.h>

int main() {
    setlocale(LC_MESSAGES, "de_DE.ISO8859-1");
    printf("%s\n", strerror(6));
    setlocale(LC_MESSAGES, "de_DE.UTF-8");
    printf("%s\n", strerror(6));
    return 0;
$ cc -o locale locale.c
$ ./locale             
Gerät ist nicht konfiguriert
Device not configured

Actually, providing the missing message catalogs is quite easy and may be automated using a script like the following:

    perl -w -e 'for (glob("*ISO8859-*msg")) { ($from) = $_ =~ m{(ISO8859-\d+)}; ($tofile = $_) =~ s{ISO8859-\d+}{UTF-8}; system "piconv -f $from -t UTF-8 $_ > $tofile"; $? == 0 or die } '