Culture and Codepage question

Discussion in 'ASP .Net' started by Mike Prager, Aug 30, 2003.

  1. Mike Prager

    Mike Prager Guest

    Hi,

    I have written a Hotmail type application where users choose their language
    preference which is used to set the culture and hence the correct resource
    files for strings, formatting etc. I now need to create a mime message but I
    have to pass in the correct encoding so the charset is correctly selected. I
    cannot find any progrmmatic correlation between the two? Is there any way to
    derive from a users culture the correct language and hence codepage and
    encoding. The Encoding class has a GteEncoding method where ou can pass in a
    codepage or a string representation e.g Windows-1252.


    Any help would be gratefully appreciated

    Thanks

    Mike
     
    Mike Prager, Aug 30, 2003
    #1
    1. Advertising

  2. Hello,

    | I have written a Hotmail type application where users choose their
    language
    | preference which is used to set the culture and hence the correct resource
    | files for strings, formatting etc. I now need to create a mime message but
    I
    | have to pass in the correct encoding so the charset is correctly selected.
    I
    | cannot find any progrmmatic correlation between the two? Is there any way
    to
    | derive from a users culture the correct language and hence codepage and
    | encoding. The Encoding class has a GteEncoding method where ou can pass in
    a
    | codepage or a string representation e.g Windows-1252.

    I hink that you may try to get ANSI codepage number via
    System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage, then
    get the appropriate encoding (via Encoding.GetEncoding method) and then ask
    for its HeaderName property.

    But better way may be to use utf-7 for all messages and everything is
    solved, regardless the language.

    --
    Michal A. Valasek, Altair Communications, http://www.altaircom.net
    Please do not reply to this e-mail, for contact see http://www.rider.cz
    Keeping Freedom safe from Democracy
     
    Michal A. Valasek, Aug 30, 2003
    #2
    1. Advertising

  3. Mike Prager

    Mike Prager Guest

    Michal,

    Brilliant! Thanks so much for this.I've been banging my head against a brick
    wall trying to suss this out. In case you are interested, the problem is
    that to generate a mime compliant file, for non ansii character sets, I need
    to encode the characters, BAse64 it and then declare it in the charset
    property of the message or header. It would be so much simpler to use
    Unicode but thats life for you!!!

    Thanks again

    Mike



    "Michal A. Valasek" <> wrote in message
    news:...
    > Hello,
    >
    > | I have written a Hotmail type application where users choose their
    > language
    > | preference which is used to set the culture and hence the correct

    resource
    > | files for strings, formatting etc. I now need to create a mime message

    but
    > I
    > | have to pass in the correct encoding so the charset is correctly

    selected.
    > I
    > | cannot find any progrmmatic correlation between the two? Is there any

    way
    > to
    > | derive from a users culture the correct language and hence codepage and
    > | encoding. The Encoding class has a GteEncoding method where ou can pass

    in
    > a
    > | codepage or a string representation e.g Windows-1252.
    >
    > I hink that you may try to get ANSI codepage number via
    > System.Globalization.CultureInfo.CurrentCulture.TextInfo.ANSICodePage,

    then
    > get the appropriate encoding (via Encoding.GetEncoding method) and then

    ask
    > for its HeaderName property.
    >
    > But better way may be to use utf-7 for all messages and everything is
    > solved, regardless the language.
    >
    > --
    > Michal A. Valasek, Altair Communications, http://www.altaircom.net
    > Please do not reply to this e-mail, for contact see http://www.rider.cz
    > Keeping Freedom safe from Democracy
    >
    >
     
    Mike Prager, Aug 30, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Benny Ng
    Replies:
    0
    Views:
    384
    Benny Ng
    Jun 17, 2004
  2. Yahya Saad

    Two Codepage

    Yahya Saad, Oct 13, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    421
    Yahya Saad
    Oct 13, 2004
  3. Daatmor

    Codepage problem

    Daatmor, Jun 15, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,572
    Joerg Jooss
    Jun 17, 2005
  4. Richard Ivarson

    Codepage for Win32 dosbox

    Richard Ivarson, Jun 29, 2003, in forum: Java
    Replies:
    1
    Views:
    4,627
    Richard Ivarson
    Jul 1, 2003
  5. Mehmet Gunacti
    Replies:
    0
    Views:
    388
    Mehmet Gunacti
    Mar 1, 2005
Loading...

Share This Page