I have created a <form>
that points to http://localhost:17099/Form/Subscribe
and hosted in my website...
Every time I try to post
North European characters, I get them like this:
That is me posting Bruno Alexandre å ø æ
as the Name
.
What do I need to do to get the correct encoded chars?
- I have tried using the
GetBytes()
to figure it out if I could convert from one encoding to the other - I have tried using this trick
- I have tried append
accept-charset="ISO-8859-1"
to the form
but nothing things to work...
If I check the Accept-Charset
from the Current Request, I get:
ISO-8859-1,utf-8;q=0.7,*;q=0.3
If I play around with System.Text.Encoding
I get this:
var name = System.Text.Encoding.GetEncoding("iso-8859-1").GetBytes(model.Name);
string n = System.Text.Encoding.UTF8.GetString( name );
n
will print as "Bruno Alexandre ? ? ?"
Drilling down and convert the string into bytes, if I send å æ ø
, this is what I get:
var b = System.Text.Encoding.GetEncoding("iso-8859-1").GetBytes(model.Name);
b[0] = 63
b[1] = 32
b[2] = 63
b[3] = 32
b[4] = 63
witch results in "? ? ?"