-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components
Milestone
Description
- Create blazor page(just replace
counter
page from basic vs blazor template):
@page "/counter"
@page "/counter/{search}"
@inject IUriHelper UriHelper
<p>
This search has problems with encoding:<br>
<input type="search"
value="@Search"
placeholder="enter here: `тест`"
oninput="@(e=> UriHelper.NavigateTo($"/counter/{e.Value.ToString()}") )" />
</p>
<p>
<input type="search"
value="@Search"
placeholder="enter here: `тест`"
oninput="@(e=> UriHelper.NavigateTo(e.Value.ToString()) )" />
</p>
<p>Search: @Search</p>
@functions {
[Parameter]
public string Search { get; set; } = string.Empty;
}
- Write any not latin text, for ex.
тест
in thesecond
input
field,
page will be navigated to the/тест
(in the browser url)
and in the input
you'll see 'тест' - Write any not latin text, for ex.
тест
in thefirst
input
field,
page will be navigated to the/counter/тест
(in_ the browser url)
and in the input
you'll see%D1%82%D0%B5%D1%81%D1%82
instead ofтест
To solve this issue, needed, somewhere for ex. in basic method of blazor component OnParametersSet
call decode method for all params, like:
protected override void OnParametersSet() {
base.OnParametersSet();
// do the same for all params
Search = System.Net.WebUtility.UrlDecode(Search);
}
Metadata
Metadata
Assignees
Labels
area-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor Components