UrlEncode French characters - wrong encoding

Discussion in 'ASP .Net' started by John C., Feb 23, 2006.

  1. John C.

    John C. Guest

    Hi, I've tried using System.Web.HttpUtility.UrlEncode("é") with each
    of the possible encodings ASCII, Unicode, UTF7, UTF8 but none of these
    gives what I want: %e9. And so on for the other French characters. Am I
    missing something here?
     
    John C., Feb 23, 2006
    #1
    1. Advertising

  2. John C. wrote:

    > Hi, I've tried using System.Web.HttpUtility.UrlEncode("é") with each
    > of the possible encodings ASCII, Unicode, UTF7, UTF8 but none of these
    > gives what I want: %e9. And so on for the other French characters. Am I
    > missing something here?


    Use ISO-8859-1 as the encoding name. Or Windows-1252. e.g.
    HttpUtility.UrlEncode("é",
    System.Text.Encoding.GetEncoding("ISO-8859-1"))


    --

    Martin Honnen --- MVP XML
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Feb 23, 2006
    #2
    1. Advertising

  3. John C.

    Joerg Jooss Guest

    Thus wrote John C.,

    > Hi, I've tried using System.Web.HttpUtility.UrlEncode("é") with each
    > of the possible encodings ASCII, Unicode, UTF7, UTF8 but none of these
    > gives what I want: %e9. And so on for the other French characters. Am
    > I missing something here?


    Yes, the correct encoding ;-)

    ISO-8859-15 or Windows-1252 is the encoding you're probably looking for:

    Encoding latin9 = Encoding.GetEncoding("iso-8859-15");
    string encodedUrl = HttpUtility.UrlEncode(url, latin9);

    Cheers,
    --
    Joerg Jooss
     
    Joerg Jooss, Feb 23, 2006
    #3
  4. John C.

    Joerg Jooss Guest

    Thus wrote Martin,

    > Use ISO-8859-1 as the encoding name. Or Windows-1252. e.g.
    > HttpUtility.UrlEncode("é",
    > System.Text.Encoding.GetEncoding("ISO-8859-1"))


    Some fun encoding trivia: There are two french glyphs that don't exist in
    ISO-8859-1: The uppercase and lowercase "oe" ligature (Unicode \u0152 and
    \u0153). That's why I've proposed Latin 9 instead in my other post. If it's
    all about "é", Latin 1 is OK :)

    Cheers,
    --
    Joerg Jooss
     
    Joerg Jooss, Feb 23, 2006
    #4
  5. Laurent Bugnion, Feb 24, 2006
    #5
  6. John C.

    John C. Guest

    Thank you so much to everyone who replied. That fixed my problem right
    away!
     
    John C., Feb 24, 2006
    #6
    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. Andreas Klemt
    Replies:
    4
    Views:
    10,302
    mikeb
    Jan 22, 2004
  2. Dario Sala
    Replies:
    1
    Views:
    3,804
    Karl Seguin
    Nov 15, 2004
  3. None

    French Encoding

    None, Aug 16, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,463
    Joerg Jooss
    Aug 21, 2005
  4. Jasmine

    encoding french

    Jasmine, Jul 13, 2004, in forum: ASP General
    Replies:
    0
    Views:
    109
    Jasmine
    Jul 13, 2004
  5. MyndPhlyp
    Replies:
    3
    Views:
    491
    MyndPhlyp
    Oct 3, 2005
Loading...

Share This Page