From 5b3c3511c9f69c047a5eb804c91f984d83779c83 Mon Sep 17 00:00:00 2001 From: Ahmed Charles Date: Thu, 11 Sep 2014 17:39:57 -0700 Subject: Fix bug in padding unicode, #17105. --- src/libcore/fmt/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index be75bfec32c..3244a72897f 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -476,7 +476,7 @@ impl<'a> Formatter<'a> { let mut prefixed = false; if self.flags & (1 << (FlagAlternate as uint)) != 0 { - prefixed = true; width += prefix.len(); + prefixed = true; width += prefix.char_len(); } // Writes the sign if it exists, and then the prefix if it was requested @@ -562,7 +562,7 @@ impl<'a> Formatter<'a> { // If we're under both the maximum and the minimum width, then fill // up the minimum width with the specified string + some alignment. Some(width) => { - self.with_padding(width - s.len(), rt::AlignLeft, |me| { + self.with_padding(width - s.char_len(), rt::AlignLeft, |me| { me.buf.write(s.as_bytes()) }) } -- cgit 1.4.1-3-g733a5