Bug#522776: debian-policy: mandate existence of a standardised UTF-8 locale
On Mon, Apr 06, 2009 at 11:09:17AM -0700, Steve Langasek wrote:
> On Mon, Apr 06, 2009 at 05:33:35PM +0000, Thorsten Glaser wrote:
> > > If you need a specific locale (as seems from "mksh", not
> > > sure if it is a bug in that program), you need to set it.
>
> > You can only set a locale on a glibc-based system if it’s
> > installed beforehand, which root needs to do.
>
> You can build-depend on the locales package and generate the locales you
> want locally, using LOCPATH to reference them. There's no need for Debian
> to guarantee the presence of a particular locale ahead of time -
> particularly one that isn't actually useful to end users, as C.UTF-8 would
> be.
Example attached of direct UTF-8 encoding in sources. Just run
in a few locales such as UTF-8, ISO-8859-1 and C and check the
differences in output.
Regards,
Roger
--
.''`. Roger Leigh
: :' : Debian GNU/Linux http://people.debian.org/~rleigh/
`. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/
`- GPG Public Key: 0x25BFB848 Please GPG sign your mail.
#include <locale.h>
#include <stdio.h>
#include <string.h>
#include <wchar.h>
int main(void)
{
setlocale(LC_ALL, "");
const char *narrow = "Test Unicode (narrow): ïàý Ноя けたいと願う!\n";
fprintf(stdout, "%s\n", narrow);
fprintf(stdout, "Narrow bytes:\n");
for (int i = 0; i< strlen(narrow); ++i)
fprintf(stdout, "%3d: %02X\n", i, (unsigned int) *((unsigned char *)narrow+i));
if (fwide (stderr, 1) <= 0)
fprintf(stdout, "Failed to set stderr to wide orientation\n");
const wchar_t *wide = L"Test Unicode (wide): ïàý Ноя けたいと願う!\n";
fwprintf(stderr, L"\n%ls\n", wide);
fwprintf(stderr, L"\nNarrow-to-wide: %s\n", narrow);
fprintf(stdout, "\nWide-to-narrow: %ls\n", wide);
fprintf(stdout, "Wide bytes:\n");
for (int i = 0; i< (wcslen(wide) * sizeof(wchar_t)); ++i)
fprintf(stdout, "%3d: %02X\n", i, (unsigned int) *((unsigned char *)wide+i));
return 0;
}
Reply to: