Репозитории ALT
Группа :: Работа с файлами
Пакет: less
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: less-382-rh-utf8.patch
Скачать
Скачать
--- less-382/charset.c.orig 2004-02-04 04:52:26 +0000
+++ less-382/charset.c 2005-02-16 13:50:39.935278768 +0000
@@ -18,6 +18,7 @@
#if HAVE_LOCALE
#include <locale.h>
#include <ctype.h>
+#include <langinfo.h>
#endif
public int utf_mode = 0;
@@ -243,25 +244,19 @@
return;
}
-#if HAVE_STRSTR
- /*
- * Check whether LC_ALL, LC_CTYPE or LANG look like UTF-8 is used.
- */
- if ((s = lgetenv("LC_ALL")) != NULL ||
- (s = lgetenv("LC_CTYPE")) != NULL ||
- (s = lgetenv("LANG")) != NULL)
- {
- if (strstr(s, "UTF-8") != NULL || strstr(s, "utf-8") != NULL)
- if (icharset("utf-8"))
- return;
- }
-#endif
-
#if HAVE_LOCALE
/*
* Use setlocale.
*/
ilocale();
+
+ /* if the locale is using UTF-8, fix up charset accordingly */
+ if ((s = nl_langinfo(CODESET)))
+ {
+ if (!strcmp(s, "UTF-8"))
+ if (icharset("utf-8"))
+ return;
+ }
#else
#if MSDOS_COMPILER
/*