|
-
Oct 10th, 2005, 06:09 AM
#1
[RESOLVED] Text encoding problem
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.
Last edited by tr333; Oct 10th, 2005 at 08:26 AM.
-
Oct 10th, 2005, 06:39 AM
#2
Re: Text encoding problem
actually that character is included in ASCII, number 132
no need to use UTF8
-
Oct 10th, 2005, 06:50 AM
#3
Re: Text encoding problem
i tried using ASCII (the default) initially, but it just showed up as '?'.
-
Oct 10th, 2005, 07:16 AM
#4
Re: Text encoding problem
 Originally Posted by Phill64
actually that character is included in ASCII, number 132
no need to use UTF8
system.web.mail uses US-ASCII, and that is only 7-bit not 8-bit.
seems like i might need to create my own smtp class, as the transfer-encoding cannot be changed (to Base64 or other).
-
Oct 10th, 2005, 07:21 AM
#5
Re: Text encoding problem
i must be blind!!!
it seems to work now using "BodyEncoding = Encoding.UTF8"
thanks for your help anyway..
-
Oct 10th, 2005, 07:23 AM
#6
Re: [RESOLVED] Text encoding problem
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
-
Oct 10th, 2005, 07:35 AM
#7
Re: [RESOLVED] Text encoding problem
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().
-
Oct 10th, 2005, 07:37 AM
#8
Re: [not RESOLVED] Text encoding problem
my code (its actually in C#):
Code:
string tmp;
while ((tmp = Console.ReadLine()) != ".")
m_message += tmp;
is there a better way to get multiple lines of text input via the console?
-
Oct 10th, 2005, 07:46 AM
#9
Re: [not RESOLVED] Text encoding problem
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.
-
Oct 10th, 2005, 07:51 AM
#10
Re: [not RESOLVED] Text encoding problem
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.
-
Oct 10th, 2005, 07:59 AM
#11
Re: [not RESOLVED] Text encoding problem
thinking that since this is console that could very well be the case i tried it out for you (I'm running WinXP)
Code:
Console.WriteLine("ä");
string str = Console.ReadLine();
Console.WriteLine(str);
worked without a problem, i copied and pasted the ä and it returned it to me intact.
-
Oct 10th, 2005, 08:25 AM
#12
Re: [not RESOLVED] Text encoding problem
still getting the '?' with your code...
it must be a problem with X11 on OSX.
i think this is now resolved (finally).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|