diff --git a/s/convert.sh b/s/convert.sh new file mode 100644 index 000000000..6a18ad8a0 --- /dev/null +++ b/s/convert.sh @@ -0,0 +1,9 @@ +#!/bin/sh +while [ ! -z $1 ] ; do + tmpfile=$(mktemp eressea.XXX) + iconv -f latin1 -t utf-8 < $1 | \ + perl -pe 's/ß/ss/; s/ä/ae/; s/ü/ue/; s/ö/oe/;' \ + > $tmpfile && \mv $tmpfile $1 + file $1 + shift 1 +done diff --git a/src/util/unicode.c b/src/util/unicode.c index cbc2db7cc..3d11ed230 100644 --- a/src/util/unicode.c +++ b/src/util/unicode.c @@ -56,7 +56,7 @@ size_t unicode_utf8_trim(char *buf) ++result; } } - if (op == buf && (iswcntrl(wc) || iswspace(wc))) { + if (op == buf && (iswspace(wc) || !iswprint(wc))) { result += size; } else if (wc>255 || !iscntrl(wc)) { @@ -64,7 +64,7 @@ size_t unicode_utf8_trim(char *buf) memmove(op, ip, size); } op += size; - if (iswcntrl(wc) || iswspace(wc)) { + if (iswspace(wc) || !iswprint(wc)) { ts += size; } else { diff --git a/src/util/unicode.h b/src/util/unicode.h index 6ebcc4794..c03e83686 100644 --- a/src/util/unicode.h +++ b/src/util/unicode.h @@ -19,8 +19,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _UNICODE_H #define _UNICODE_H -#include #include +#include #ifdef __cplusplus extern "C" {