UrlDecode

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    UrlDecode

    Hi,

    I UrlEncode a value that I put in my querystring. This value originally
    contains the character "è", which is UrlEncoded to "%E8". When I try
    to read the value from the querystring, I find out that the character
    now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
    the original character, which is a problem. My site is using CMS. Any
    idea what is going on?

    Thank you for any support,

    Alex

  • Dave Sexton

    #2
    Re: UrlDecode

    Hi Alex,

    That character should be encoded to %c3%a8, not %E8. It should appear as
    %c3%a8 in the query string.

    Use the System.Web.Http Utility.UrlEnco de and UrlDecode methods.

    --
    Dave Sexton

    "Alex" <asoares1@gmail .comwrote in message
    news:1161703368 .612387.167700@ k70g2000cwa.goo glegroups.com.. .
    Hi,

    I UrlEncode a value that I put in my querystring. This value originally
    contains the character "è", which is UrlEncoded to "%E8". When I try
    to read the value from the querystring, I find out that the character
    now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
    the original character, which is a problem. My site is using CMS. Any
    idea what is going on?

    Thank you for any support,

    Alex


    Comment

    • Alex

      #3
      Re: UrlDecode

      Actually it does encode to %c3%a8 (I already use
      HttpUtility.Url Encode), I mixed things up writing %E8. Sorry my
      mistake. But there is no mistake in my original problem tought ;) It
      ends up as %u00c3%u00a8 which can be UrlDecoded correctly. Why the %u00
      (I guess it means it is unicode encoding characters...)

      Thanks,

      Dave Sexton wrote:
      Hi Alex,
      >
      That character should be encoded to %c3%a8, not %E8. It should appear as
      %c3%a8 in the query string.
      >
      Use the System.Web.Http Utility.UrlEnco de and UrlDecode methods.
      >
      --
      Dave Sexton
      >
      "Alex" <asoares1@gmail .comwrote in message
      news:1161703368 .612387.167700@ k70g2000cwa.goo glegroups.com.. .
      Hi,
      >
      I UrlEncode a value that I put in my querystring. This value originally
      contains the character "è", which is UrlEncoded to "%E8". When I try
      to read the value from the querystring, I find out that the character
      now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
      the original character, which is a problem. My site is using CMS. Any
      idea what is going on?

      Thank you for any support,

      Alex

      Comment

      • Dave Sexton

        #4
        Re: UrlDecode

        Hi Alex,

        I can't reproduce your problem. When I supply a string containing the
        specified character to HttpUtility.Url Encode it returns "%c3%a8". When I pass
        "%c3%a8" to HttpUtility.Url Decode it returns the specified character.
        (verified in 2.0)

        Where are you getting "%u00c3%u00 a8" from?

        --
        Dave Sexton

        "Alex" <asoares1@gmail .comwrote in message
        news:1161710453 .204938.315650@ e3g2000cwe.goog legroups.com...
        Actually it does encode to %c3%a8 (I already use
        HttpUtility.Url Encode), I mixed things up writing %E8. Sorry my
        mistake. But there is no mistake in my original problem tought ;) It
        ends up as %u00c3%u00a8 which can be UrlDecoded correctly. Why the %u00
        (I guess it means it is unicode encoding characters...)

        Thanks,

        Dave Sexton wrote:
        Hi Alex,
        >
        That character should be encoded to %c3%a8, not %E8. It should appear as
        %c3%a8 in the query string.
        >
        Use the System.Web.Http Utility.UrlEnco de and UrlDecode methods.
        >
        --
        Dave Sexton
        >
        "Alex" <asoares1@gmail .comwrote in message
        news:1161703368 .612387.167700@ k70g2000cwa.goo glegroups.com.. .
        Hi,
        >
        I UrlEncode a value that I put in my querystring. This value originally
        contains the character "è", which is UrlEncoded to "%E8". When I try
        to read the value from the querystring, I find out that the character
        now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
        the original character, which is a problem. My site is using CMS. Any
        idea what is going on?
        >
        Thank you for any support,
        >
        Alex

        Comment

        • Alex

          #5
          Re: UrlDecode

          I specified my site is using CMS. I think it comes from CMS. I am not
          sure I understand how to decode the string I am getting... I'll try and
          post to a CMS channel to see if anyone ever experienced something
          similar.

          Dave Sexton wrote:
          Hi Alex,
          >
          I can't reproduce your problem. When I supply a string containing the
          specified character to HttpUtility.Url Encode it returns "%c3%a8". When Ipass
          "%c3%a8" to HttpUtility.Url Decode it returns the specified character.
          (verified in 2.0)
          >
          Where are you getting "%u00c3%u00 a8" from?
          >
          --
          Dave Sexton
          >
          "Alex" <asoares1@gmail .comwrote in message
          news:1161710453 .204938.315650@ e3g2000cwe.goog legroups.com...
          Actually it does encode to %c3%a8 (I already use
          HttpUtility.Url Encode), I mixed things up writing %E8. Sorry my
          mistake. But there is no mistake in my original problem tought ;) It
          ends up as %u00c3%u00a8 which can be UrlDecoded correctly. Why the %u00
          (I guess it means it is unicode encoding characters...)
          >
          Thanks,
          >
          Dave Sexton wrote:
          Hi Alex,

          That character should be encoded to %c3%a8, not %E8. It should appear as
          %c3%a8 in the query string.

          Use the System.Web.Http Utility.UrlEnco de and UrlDecode methods.

          --
          Dave Sexton

          "Alex" <asoares1@gmail .comwrote in message
          news:1161703368 .612387.167700@ k70g2000cwa.goo glegroups.com.. .
          Hi,

          I UrlEncode a value that I put in my querystring. This value originally
          contains the character "è", which is UrlEncoded to "%E8". When I try
          to read the value from the querystring, I find out that the character
          now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
          the original character, which is a problem. My site is using CMS. Any
          idea what is going on?

          Thank you for any support,

          Alex

          Comment

          • Dave Sexton

            #6
            Re: UrlDecode

            Hi Alex,

            That's a good idea.

            GL

            --
            Dave Sexton

            "Alex" <asoares1@gmail .comwrote in message
            news:1161712104 .272516.215870@ h48g2000cwc.goo glegroups.com.. .
            I specified my site is using CMS. I think it comes from CMS. I am not
            sure I understand how to decode the string I am getting... I'll try and
            post to a CMS channel to see if anyone ever experienced something
            similar.

            Dave Sexton wrote:
            Hi Alex,
            >
            I can't reproduce your problem. When I supply a string containing the
            specified character to HttpUtility.Url Encode it returns "%c3%a8". When I
            pass
            "%c3%a8" to HttpUtility.Url Decode it returns the specified character.
            (verified in 2.0)
            >
            Where are you getting "%u00c3%u00 a8" from?
            >
            --
            Dave Sexton
            >
            "Alex" <asoares1@gmail .comwrote in message
            news:1161710453 .204938.315650@ e3g2000cwe.goog legroups.com...
            Actually it does encode to %c3%a8 (I already use
            HttpUtility.Url Encode), I mixed things up writing %E8. Sorry my
            mistake. But there is no mistake in my original problem tought ;) It
            ends up as %u00c3%u00a8 which can be UrlDecoded correctly. Why the %u00
            (I guess it means it is unicode encoding characters...)
            >
            Thanks,
            >
            Dave Sexton wrote:
            Hi Alex,

            That character should be encoded to %c3%a8, not %E8. It should appear as
            %c3%a8 in the query string.

            Use the System.Web.Http Utility.UrlEnco de and UrlDecode methods.

            --
            Dave Sexton

            "Alex" <asoares1@gmail .comwrote in message
            news:1161703368 .612387.167700@ k70g2000cwa.goo glegroups.com.. .
            Hi,

            I UrlEncode a value that I put in my querystring. This value originally
            contains the character "è", which is UrlEncoded to "%E8". When I try
            to read the value from the querystring, I find out that the character
            now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
            the original character, which is a problem. My site is using CMS. Any
            idea what is going on?

            Thank you for any support,

            Alex

            Comment

            • Alex

              #7
              Re: UrlDecode

              Anyhow, thanks for your answers!

              Dave Sexton wrote:
              Hi Alex,
              >
              That's a good idea.
              >
              GL
              >
              --
              Dave Sexton
              >
              "Alex" <asoares1@gmail .comwrote in message
              news:1161712104 .272516.215870@ h48g2000cwc.goo glegroups.com.. .
              I specified my site is using CMS. I think it comes from CMS. I am not
              sure I understand how to decode the string I am getting... I'll try and
              post to a CMS channel to see if anyone ever experienced something
              similar.
              >
              Dave Sexton wrote:
              Hi Alex,

              I can't reproduce your problem. When I supply a string containing the
              specified character to HttpUtility.Url Encode it returns "%c3%a8". WhenI
              pass
              "%c3%a8" to HttpUtility.Url Decode it returns the specified character.
              (verified in 2.0)

              Where are you getting "%u00c3%u00 a8" from?

              --
              Dave Sexton

              "Alex" <asoares1@gmail .comwrote in message
              news:1161710453 .204938.315650@ e3g2000cwe.goog legroups.com...
              Actually it does encode to %c3%a8 (I already use
              HttpUtility.Url Encode), I mixed things up writing %E8. Sorry my
              mistake. But there is no mistake in my original problem tought ;) It
              ends up as %u00c3%u00a8 which can be UrlDecoded correctly. Why the %u00
              (I guess it means it is unicode encoding characters...)

              Thanks,

              Dave Sexton wrote:
              Hi Alex,
              >
              That character should be encoded to %c3%a8, not %E8. It should appear as
              %c3%a8 in the query string.
              >
              Use the System.Web.Http Utility.UrlEnco de and UrlDecode methods.
              >
              --
              Dave Sexton
              >
              "Alex" <asoares1@gmail .comwrote in message
              news:1161703368 .612387.167700@ k70g2000cwa.goo glegroups.com.. .
              Hi,
              >
              I UrlEncode a value that I put in my querystring. This value originally
              contains the character "è", which is UrlEncoded to "%E8". When I try
              to read the value from the querystring, I find out that the character
              now is "%u00c3%u00 a8" in the querystring and thus does not urldecode to
              the original character, which is a problem. My site is using CMS. Any
              idea what is going on?
              >
              Thank you for any support,
              >
              Alex

              Comment

              • Joerg Jooss

                #8
                Re: UrlDecode

                Thus wrote Dave,
                Hi Alex,
                >
                That character should be encoded to %c3%a8, not %E8. It should appear
                as %c3%a8 in the query string.
                There is no "should", since there is no defined character encoding for ULR
                encoding -- it can be anything sender and receiver understand.

                Cheers,
                --
                Joerg Jooss
                news-reply@joergjoos s.de


                Comment

                • Dave Sexton

                  #9
                  Re: UrlDecode

                  Hi Joerg,

                  That is certainly true, however neither "%E8" nor "%u00c3%u00 a8" are returned
                  using HttpUtility.Url Encode, even when specifying any of the FCL Encodings.
                  It should, by default, be "%c3%a8".

                  --
                  Dave Sexton

                  "Joerg Jooss" <news-reply@joergjoos s.dewrote in message
                  news:b1ae576352 f768c8c5c484644 b3e@msnews.micr osoft.com...
                  Thus wrote Dave,
                  >
                  >Hi Alex,
                  >>
                  >That character should be encoded to %c3%a8, not %E8. It should appear
                  >as %c3%a8 in the query string.
                  >
                  There is no "should", since there is no defined character encoding for ULR
                  encoding -- it can be anything sender and receiver understand.
                  Cheers,
                  --
                  Joerg Jooss
                  news-reply@joergjoos s.de
                  >
                  >

                  Comment

                  • Joerg Jooss

                    #10
                    Re: UrlDecode

                    Thus wrote Dave,
                    Hi Joerg,
                    >
                    That is certainly true, however neither "%E8" nor "%u00c3%u00 a8" are
                    returned using HttpUtility.Url Encode, even when specifying any of the
                    FCL Encodings.
                    Then you're doing something wrong ;-)

                    string s = HttpUtility.Url Encode("è", Encoding.GetEnc oding(28591));
                    Console.WriteLi ne(s);

                    Cheers,
                    --
                    Joerg Jooss
                    news-reply@joergjoos s.de


                    Comment

                    • Dave Sexton

                      #11
                      Re: UrlDecode

                      Hi Joerg,

                      The OP didn't specify any encoding and so I assumed that UrlEncode was being
                      used without any explicit encoding specified - my mistake.

                      I didn't mean to imply that it's not possible for UrlEncode to return "%e8", I
                      simply meant that you can't get it using the "FCL encodings", such as ASCII,
                      UTF8, UTF7, UTF32, Unicode and BigEndianUnicod e or by not specifying any
                      encoding at all, because that's what I tested originally. I was just trying
                      to explain the intent for my original response :)

                      To answer the OP's question, I iterated over every encoding returned by
                      Encoding.GetEnc odings looking for one that converts the specified character to
                      "%u00c3%u00 a8". 28591 does convert the character to %e8, just like Western
                      European (Windows) - 1252 (Encoding.Defau lt for me), and a few others, but
                      that isn't the problem at hand. The OP needs to decode "%u00c3%u00 a8" but at
                      this point it doesn't seem like a valid encoding that can be produced by the
                      framework.

                      --
                      Dave Sexton

                      "Joerg Jooss" <news-reply@joergjoos s.dewrote in message
                      news:b1ae576352 fec8c8c5da30e8d 7a7@msnews.micr osoft.com...
                      Thus wrote Dave,
                      >
                      >Hi Joerg,
                      >>
                      >That is certainly true, however neither "%E8" nor "%u00c3%u00 a8" are
                      >returned using HttpUtility.Url Encode, even when specifying any of the
                      >FCL Encodings.
                      >
                      Then you're doing something wrong ;-)
                      >
                      string s = HttpUtility.Url Encode("è", Encoding.GetEnc oding(28591));
                      Console.WriteLi ne(s);
                      >
                      Cheers, --
                      Joerg Jooss
                      news-reply@joergjoos s.de
                      >
                      >

                      Comment

                      Working...