diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 858545bd0984..2034abdfd156 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -582,6 +582,7 @@ fn next(&mut self) -> Option {
}
}
let id = self.id_map.derive(id);
+ let percent_encoded_id = small_url_encode(id.clone());
if let Some(ref mut builder) = self.toc {
let mut text_header = String::new();
@@ -596,8 +597,9 @@ fn next(&mut self) -> Option {
std::cmp::min(level as u32 + (self.heading_offset as u32), MAX_HEADER_LEVEL);
self.buf.push_back((Event::Html(format!("").into()), 0..0));
- let start_tags =
- format!("§");
+ let start_tags = format!(
+ "§"
+ );
return Some((Event::Html(start_tags.into()), 0..0));
}
event
diff --git a/tests/rustdoc-html/unicode.rs b/tests/rustdoc-html/unicode.rs
new file mode 100644
index 000000000000..a961f178ec3b
--- /dev/null
+++ b/tests/rustdoc-html/unicode.rs
@@ -0,0 +1,10 @@
+#![crate_name = "unicode"]
+
+pub struct Foo;
+
+impl Foo {
+ //@ has unicode/struct.Foo.html //a/@href "#%C3%BA"
+ //@ !has unicode/struct.Foo.html //a/@href "#ú"
+ /// # ú
+ pub fn foo() {}
+}