Accepting request 147916 from home:dstoecker

Reintroduce UTF-8 fix.

OBS-URL: https://build.opensuse.org/request/show/147916
OBS-URL: https://build.opensuse.org/package/show/editors/nedit?expand=0&rev=8
This commit is contained in:
Ismail Dönmez 2013-01-12 12:44:43 +00:00 committed by Git OBS Bridge
parent f24de0b229
commit c3c46119d7
3 changed files with 64 additions and 0 deletions

57
nedit-5.5CVS-utf8.patch Normal file
View File

@ -0,0 +1,57 @@
Index: source/nedit.c
===================================================================
RCS file: /cvsroot/nedit/nedit/source/nedit.c,v
retrieving revision 1.101
diff -u -r1.101 nedit.c
--- source/nedit.c 25 Oct 2012 14:10:25 -0000 1.101
+++ source/nedit.c 10 Jan 2013 11:55:32 -0000
@@ -96,6 +96,7 @@
static void maskArgvKeywords(int argc, char **argv, const char **maskArgs);
static void unmaskArgvKeywords(int argc, char **argv, const char **maskArgs);
static void fixupBrokenXKeysymDB(void);
+static void changeLocaleIfUTF8(void);
static void patchResourcesForVisual(void);
static void patchResourcesForKDEbug(void);
static void patchLocaleForMotif(void);
@@ -425,6 +426,8 @@
/* Save the command which was used to invoke nedit for restart command */
ArgV0 = argv[0];
+ changeLocaleIfUTF8();
+
/* Set locale for C library, X, and Motif input functions.
Reverts to "C" if requested locale not available. */
XtSetLanguageProc(NULL, neditLanguageProc, NULL);
@@ -1133,6 +1136,32 @@
return setlocale(LC_ALL, NULL); /* re-query in case overwritten */
}
+static void changeLocaleIfUTF8(void)
+{
+ char *locale;
+
+ locale = getenv("LANG");
+ if (!locale) {
+ locale = setlocale(LC_ALL, NULL);
+ }
+
+ if (locale) {
+ char *ptr;
+
+ ptr = strstr(locale, ".UTF-8");
+ if (ptr) {
+ fprintf(stderr, "nedit: the current locale is utf8 (%s)\n", locale);
+
+ ptr[0] = '\0';
+
+ setenv("LC_ALL", locale, 1);
+ locale = setlocale(LC_ALL, locale);
+
+ fprintf(stderr, "nedit: changed locale to non-utf8 (%s)\n", locale);
+ }
+ }
+}
+
static int sortAlphabetical(const void* k1, const void* k2)
{
const char* key1 = *(const char**)k1;

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jan 10 12:05:37 UTC 2013 - opensuse@dstoecker.de
- reintroduce UTF-8 patch which changes default locale to non-UTF-8 (setting LANG=en_US.utf-8 in commandline still works)
-------------------------------------------------------------------
Fri Oct 26 19:30:58 UTC 2012 - opensuse@dstoecker.de

View File

@ -18,6 +18,7 @@ Patch1: %{name}-5.5CVS-makefiles.patch
Patch2: %{name}-5.5CVS-security.patch
Patch3: %{name}-5.5CVS-nc-manfix.patch
Patch4: %{name}-5.5-visfix.patch
Patch5: %{name}-5.5CVS-utf8.patch
%description
NEdit is a GUI style plain text editor for workstations with the X Window System
@ -31,6 +32,7 @@ and a lot other nice features (and extensions for programmers).
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p0
%build
#find -name .cvsignore |xargs rm