Results 1 to 12 of 12

Thread: [RESOLVED] Text encoding problem

  1. #1

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Resolved [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.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  2. #2
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: Text encoding problem

    actually that character is included in ASCII, number 132

    no need to use UTF8

  3. #3

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Text encoding problem

    i tried using ASCII (the default) initially, but it just showed up as '?'.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  4. #4

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Text encoding problem

    Quote 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).
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  5. #5

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    Re: Text encoding problem

    i must be blind!!!

    it seems to work now using "BodyEncoding = Encoding.UTF8"


    thanks for your help anyway..
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  6. #6
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    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

  7. #7

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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().
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  8. #8

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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?
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  9. #9
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    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.

  10. #10

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  11. #11
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    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.

  12. #12

    Thread Starter
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,605

    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).
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width