Reputation: 1552
I have a ASP.NET Core 3.1 web server and I'm receiving post requests like this:
[HttpPost("/api/loginweb")]
public IActionResult loginWeb([FromHeader(Name = "usuario")] String usuario, [FromHeader(Name = "pass")] String pass)
{
The problem I have is sending the ñ character on a header:
But, when I receive it I get:
Upvotes: 1
Views: 889
Reputation: 6881
You can right-click
barñfoo in postman, choose EncodeURlComponent option, and then when the data of usuario
is received, use HttpUtility.UrlDecode() method to get the string containing special characters.
[HttpPost("/api/loginweb")]
public IActionResult loginWeb([FromHeader(Name = "usuario")] string usuario, [FromHeader(Name = "pass")] string pass)
{
usuario = HttpUtility.UrlDecode(usuario);
return Ok();
}
Here is the process to test:
I have found a thread which explains the reason of this phenomena. You can have a look for this
Upvotes: 1