This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
RE: libiconv for windres
- From: Danny Smith <dannysmith at clear dot net dot nz>
- To: 'Kai Tietz' <Kai dot Tietz at onevision dot com>, Binutils <binutils at sourceware dot org>
- Date: Fri, 01 Jun 2007 21:34:14 +1200
- Subject: RE: libiconv for windres
Why is this table necessary on windows?
+/* Languages supported. */
+static const wind_language_t languages[] =
+{
+ { 0x0000, 437, 1252, "Neutral", "Neutral" },
+ { 0x0401, 864, 1256, "Arabic", "Saudi Arabia" }, { 0x0402, 866, 1251, "Bulgarian", "Bulgaria" },
+ { 0x0403, 850, 1252, "Catalan", "Spain" }, { 0x0404, 950, 950, "Chinese", "Taiwan" },
+ { 0x0405, 852, 1250, "Czech", "Czech Republic" }, { 0x0406, 850, 1252, "Danish", "Denmark" },
+ { 0x0407, 850, 1252, "German", "Germany" }, { 0x0408, 737, 1253, "Greek", "Greece" },
+ { 0x0409, 437, 1252, "English", "United States" }, { 0x040A, 850, 1252, "Spanish - Traditional Sort", "Spain" },
....
We can fetch the codepage from the language id by
using the windows API in winnt.h
and avoid having to resync when supported LANG,SUBLANG pairs change
static unsigned int
codepage_from_langid (unsigned short langid)
{
#define max_cp_string_len 6
char cp_string [max_cp_string_len];
int c;
memset (cp_string, 0, max_cp_string_len);
/* LOCALE_RETURN_NUMBER flag would avoid strtoul conversion,
but is unavailable on Win95. */
c = GetLocaleInfoA (MAKELCID (langid, SORT_DEFAULT),
LOCALE_IDEFAULTANSICODEPAGE,
cp_string, max_cp_string_len);
/* If codepage data for an LCID is not installed on users's system,
GetLocaleInfo returns an empty string. Fall back to system ANSI
default. */
if ( c == 0 )
return CP_ACP;
return strtoul (cp_string, 0, 10);
}