if (codeset[0] == '\0') codeset = "ASCII";
locale_charset (){  const char *codeset;  const char *aliases;#ifndef WIN32# if HAVE_LANGINFO_CODESET  /* Most systems support nl_langinfo (CODESET) nowadays.  */  codeset = nl_langinfo (CODESET);# else  /* On old systems which lack it, use setlocale or getenv.  */  const char *locale = NULL;  /* But most old systems don't have a complete set of locales.  Some     (like SunOS 4 or DJGPP) have only the C locale.  Therefore we don't     use setlocale here; it would return "C" when it doesn't support the     locale name the user has set.  */#  if HAVE_SETLOCALE && 0  locale = setlocale (LC_CTYPE, NULL);#  endif  if (locale == NULL || locale[0] == '\0')    {      locale = getenv ("LC_ALL");      if (locale == NULL || locale[0] == '\0')	{	  locale = getenv ("LC_CTYPE");	  if (locale == NULL || locale[0] == '\0')	    locale = getenv ("LANG");	}    }  /* On some old systems, one used to set locale = "iso8859_1". On others,     you set it to "language_COUNTRY.charset". In any case, we resolve it     through the charset.alias file.  */  codeset = locale;# endif#else /* WIN32 */  static char buf[2 + 10 + 1];  /* Win32 has a function returning the locale's codepage as a number.  */  sprintf (buf, "CP%u", GetACP ());  codeset = buf;#endif  if (codeset == NULL)    /* The canonical name cannot be determined.  */    codeset = "";  /* Resolve alias. */  for (aliases = get_charset_aliases ();       *aliases != '\0';       aliases += strlen (aliases) + 1, aliases += strlen (aliases) + 1)    if (strcmp (codeset, aliases) == 0	|| (aliases[0] == '*' && aliases[1] == '\0'))      {	codeset = aliases + strlen (aliases) + 1;	break;      }  return codeset;}