Fixed a bug in extfmt where it couldn't parse unicode in format strings.

This commit is contained in:
Eric Holk 2012-06-07 11:35:58 -07:00
parent 015527b0ce
commit 21d56f2c68

View File

@ -94,7 +94,8 @@ mod ct {
}
let mut i = 0u;
while i < lim {
let curr = str::slice(s, i, i+1u);
let size = str::utf8_char_width(s[i]);
let curr = str::slice(s, i, i+size);
if str::eq(curr, "%") {
i += 1u;
if i >= lim {
@ -110,7 +111,7 @@ mod ct {
pieces += [rs.piece];
i = rs.next;
}
} else { buf += curr; i += 1u; }
} else { buf += curr; i += size; }
}
flush_buf(buf, pieces);
ret pieces;