+!! test
+File containing single quotes
+!! wikitext
+[[File:Foo's ''italic'' bar.jpg]]
+[[File:Foo's ''italic'' bar.jpg|Foo's ''italic'' bar]]
+!! html/php+tidy
+<p><a href="/index.php?title=Special:Upload&wpDestFile=Foo%27s_%27%27italic%27%27_bar.jpg" class="new" title="File:Foo's ''italic'' bar.jpg">File:Foo's <i>italic</i> bar.jpg</a>
+<a href="/index.php?title=Special:Upload&wpDestFile=Foo%27s_%27%27italic%27%27_bar.jpg" class="new" title="File:Foo's ''italic'' bar.jpg">Foo's italic bar</a>
+</p>
+!! end
+