about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAhmed Charles <acharles@outlook.com>2014-09-11 17:39:57 -0700
committerAhmed Charles <acharles@outlook.com>2014-09-11 17:40:46 -0700
commit5b3c3511c9f69c047a5eb804c91f984d83779c83 (patch)
tree2d5fa89fc4820670a356272ad5c6bcebe8b130cd /src/libcore
parent06c0b1d28ac28ca42d6c179293e333a012a8a3fc (diff)
Fix bug in padding unicode, #17105.
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/fmt/mod.rs4
1 files changed, 2 insertions, 2 deletions
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())
                 })
             }