☝🏽 this image is called göögle plus.png - which must be encoded to g%C3%B6%C3%B6gle%20plus.png
göögle plus.png
g%C3%B6%C3%B6gle%20plus.png
@inherits Custom.Hybrid.Razor14 @using ToSic.Razor.Blade @{ var path = App.Path + "/razorblade/tags/img/"; var exampleImgName = "göögle plus.png"; var resizeParameters = "?w=100"; var safeUrl = Tags.SafeUrl(path + exampleImgName + resizeParameters); } <img loading="lazy" src='@safeUrl' id="demo-logo"> <p> ☝🏽 this image is called <code>@exampleImgName</code> - which must be encoded to <code>@Tags.SafeUrl(exampleImgName)</code> </p> <style> #demo-logo { width: 50px; padding-right: 20px; } </style>
Sometimes you have files with unexpected characters - like umlauts or spaces. The best way to encode this is using Tags.SafeUrl(...) from RazorBlade, or Uri.EscapeUriString(...) from .net.
Tags.SafeUrl(...)
Uri.EscapeUriString(...)
+
%
spaces
öäè
Server.UrlEcode(...)
@@using System