diff options
author | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-31 21:09:46 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@gmx.de> | 2012-12-31 21:09:46 +0100 |
commit | 6cadd03bbeace1c256ba875c2e6a877f924877cd (patch) | |
tree | 8079ea6f6ccdb1c2cbb2b7813f618837617cb33e /sys/src/libhtml | |
parent | 6d99096136278f06f6333f927da34105a8dfe0bf (diff) |
fix utf and rune handling in preparation for 32bit runes
Diffstat (limited to 'sys/src/libhtml')
-rw-r--r-- | sys/src/libhtml/lex.c | 4 | ||||
-rw-r--r-- | sys/src/libhtml/utils.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/sys/src/libhtml/lex.c b/sys/src/libhtml/lex.c index ca8fc77d6..70106b9b4 100644 --- a/sys/src/libhtml/lex.c +++ b/sys/src/libhtml/lex.c @@ -1310,9 +1310,9 @@ getchar(TokenSource* ts) break; case UTF_8: ok = fullrune((char*)(buf+ts->i), ts->edata-ts->i); - n = chartorune(&r, (char*)(buf+ts->i)); if(ok) { - if(warn && c == 0x80) + n = chartorune(&r, (char*)(buf+ts->i)); + if(warn && c == Runeerror) fprint(2, "warning: invalid utf-8 sequence (starts with %x)\n", ts->data[ts->i]); ts->i += n; c = r; diff --git a/sys/src/libhtml/utils.c b/sys/src/libhtml/utils.c index 5998913ac..7b272d904 100644 --- a/sys/src/libhtml/utils.c +++ b/sys/src/libhtml/utils.c @@ -535,7 +535,7 @@ toStr(uchar* buf, int n, int chset) // Convert buf[0:n], Unicode characters, // into an emalloc'd null-terminated string in character set chset. -// Use 0x80 for unconvertable characters. +// Use Runeerror for unconvertable characters. uchar* fromStr(Rune* buf, int n, int chset) { @@ -554,7 +554,7 @@ fromStr(Rune* buf, int n, int chset) for(i = 0; i < n; i++) { ch = buf[i]; if(ch > lim) - ch = 0x80; + ch = Runeerror; ans[i] = ch; } ans[n] = 0; |