forked from github/server
fixing the umlaut-check to run in UTF8 locales
This commit is contained in:
parent
ff8bfefc44
commit
abca6ab6a1
1 changed files with 16 additions and 16 deletions
|
@ -23,7 +23,7 @@
|
||||||
#include "goodies.h"
|
#include "goodies.h"
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
#include <ctype.h>
|
#include <wctype.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
@ -76,21 +76,21 @@ set_string (char **s, const char *neu)
|
||||||
boolean
|
boolean
|
||||||
locale_check(void)
|
locale_check(void)
|
||||||
{
|
{
|
||||||
int i, errorlevel = 0;
|
int i, errorlevel = 0;
|
||||||
unsigned char * umlaute = (unsigned char*)"äöüÄÖÜß";
|
const unsigned char * umlaute = (const unsigned char*)"äöüÄÖÜß";
|
||||||
/* E: das prüft, ob umlaute funktionieren. Wenn äöü nicht mit isalpha() true sind, kriegen wir ärger. */
|
/* E: das testet, ob umlaute funktionieren. Wenn äöü nicht mit isalpha() true sind, kriegen wir ärger. */
|
||||||
for (i=0;i!=3;++i) {
|
for (i=0;i!=3;++i) {
|
||||||
if (toupper(umlaute[i])!=(int)umlaute[i+3]) {
|
if (towupper(umlaute[i])!=(int)umlaute[i+3]) {
|
||||||
++errorlevel;
|
++errorlevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i=0;umlaute[i]!=0;++i) {
|
for (i=0;umlaute[i]!=0;++i) {
|
||||||
if (!isalpha(umlaute[i]) || isspace(umlaute[i]) || iscntrl(umlaute[i])) {
|
if (!iswalpha(umlaute[i]) || iswspace(umlaute[i]) || iswcntrl(umlaute[i])) {
|
||||||
++errorlevel;
|
++errorlevel;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (errorlevel) return false;
|
if (errorlevel) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
Loading…
Reference in a new issue