Bug 196286 - utf-8 variants of libc.cat missing
Summary: utf-8 variants of libc.cat missing
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: conf (show other bugs)
Version: 10.1-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-12-26 19:20 UTC by eserte12
Modified: 2015-03-07 13:45 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 } '

Regards,
    Slaven