better utf
This commit is contained in:
parent
a38a183626
commit
54357361fb
1 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "slug.h"
|
#include "slug.h"
|
||||||
//#include <libc.h>
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <utf.h>
|
||||||
|
|
||||||
static char *bufptr(int);
|
static char *bufptr(int);
|
||||||
|
|
||||||
|
|
@ -156,7 +156,7 @@ static char *getutf(FILE *fp) // get 1 utf-encoded char (might be multiple bytes
|
||||||
|
|
||||||
for (*p = 0; (*p++ = getc(fp)) != EOF; ) {
|
for (*p = 0; (*p++ = getc(fp)) != EOF; ) {
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if (mblen(buf, sizeof buf) > 0) // found a valid character
|
if (fullrune(buf, p-buf)) // found a valid character
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue