summaryrefslogtreecommitdiff
path: root/src/cmd/gc/subr.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/gc/subr.c')
-rw-r--r--src/cmd/gc/subr.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/cmd/gc/subr.c b/src/cmd/gc/subr.c
index ee47cc8e1..7072d95e4 100644
--- a/src/cmd/gc/subr.c
+++ b/src/cmd/gc/subr.c
@@ -1525,6 +1525,7 @@ Zconv(Fmt *fp)
Rune r;
Strlit *sp;
char *s, *se;
+ int n;
sp = va_arg(fp->args, Strlit*);
if(sp == nil)
@@ -1533,8 +1534,15 @@ Zconv(Fmt *fp)
s = sp->s;
se = s + sp->len;
while(s < se) {
- s += chartorune(&r, s);
+ n = chartorune(&r, s);
+ s += n;
switch(r) {
+ case Runeerror:
+ if(n == 1) {
+ fmtprint(fp, "\\x%02x", *(s-1));
+ break;
+ }
+ // fall through
default:
if(r < ' ') {
fmtprint(fp, "\\x%02x", r);