if i want to send the character 'ä' in an e-mail using System.Web.Mail, what encoding should i use for the BodyEncoding? i have tried UTF8 but it doesnt seem to work.
Printable View
if i want to send the character 'ä' in an e-mail using System.Web.Mail, what encoding should i use for the BodyEncoding? i have tried UTF8 but it doesnt seem to work.
actually that character is included in ASCII, number 132
no need to use UTF8
i tried using ASCII (the default) initially, but it just showed up as '?'.
system.web.mail uses US-ASCII, and that is only 7-bit not 8-bit.Quote:
Originally Posted by Phill64
seems like i might need to create my own smtp class, as the transfer-encoding cannot be changed (to Base64 or other).
i must be blind!!! :D
it seems to work now using "BodyEncoding = Encoding.UTF8"
thanks for your help anyway..
hmm,
don't see why unicode wouldn't work.
are you sending it as a string constant? perhaps it's converting ASCII to UTF8 and failing.
http://www.tony-franks.co.uk/UTF-8.htm
according to that it is #228
perhaps try passing it using its number
EDIT NOTE: Oh, glad to see it worked out :thumb:
it seems to work when i hardcode the character into the string (eg. mystr = "ä") but not when i copy/paste the character into the terminal and read it in via Console.ReadLine().
my code (its actually in C#):
is there a better way to get multiple lines of text input via the console?Code:string tmp;
while ((tmp = Console.ReadLine()) != ".")
m_message += tmp;
perhaps you'll need to use System.Encoding.Convert()
I'm not sure if that will make a difference or not.
although if it's only the "a" you will ever use it may be easier to find out what the character is coming in as, and what it should be.
what i mean is.. find out the value of "a" hardcoded, and then find it out inputted from the UI and see how the differ, you may be able to get away with a find replace.
i have tried to print out the character with Console.WriteLine("ä"); but it still appears as '?'.
i am doing this on OSX with Mono, wo im not sure if the problem is specific to OSX or if it also occurs on windows.
thinking that since this is console that could very well be the case i tried it out for you (I'm running WinXP)
worked without a problem, i copied and pasted the ä and it returned it to me intact.Code:Console.WriteLine("ä");
string str = Console.ReadLine();
Console.WriteLine(str);
still getting the '?' with your code...
it must be a problem with X11 on OSX.
i think this is now resolved (finally).