Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Problem with encodeURIcomponent in Connection Manager

Expand Messages
  • Pierre Goiffon
    ... Date : Thu, 30 Nov 2006 20:52:36 +0100 De : Thomas Chille Répondre à : ydn-javascript@yahoogroups.com Objet : [ydn-javascript]
    Message 1 of 2 , Dec 1, 2006
    • 0 Attachment
      ----- Message de thomas.chille@... ---------
      Date : Thu, 30 Nov 2006 20:52:36 +0100
      De : Thomas Chille <thomas.chille@...>
      Répondre à : ydn-javascript@yahoogroups.com
      Objet : [ydn-javascript] Problem with encodeURIcomponent in
      Connection Manager
      À : ydn-javascript@yahoogroups.com


      > 'ä' should be '%E4' and not ''%C3%A4'
      (...)
      > i wanna send form data via the Connection Manager to the server.
      > special german chars from the charset ISO-8859-1should be url encoded
      > before. for this the Connection Manager is allways calling the buildin
      > JS function encodeURIcomponent for every form value.
      >
      > this call returns not the right string for me.
      >
      > normally the char 'ä' should be converted to '%E4' , but
      > encodeURIcomponent() is producing '%C3%A4'

      In ISO Latin-1 (8859-1), ä is encoded as E4
      In UTF-8, this same glyph is encoded as C3A4
      (you can check http://www.miakinen.net/vrac/charsets/ - sorry french
      webpage, but I think you'll undestand quickly what you'll see)

      In DevMo the encodeURIcomponent is said to always sends back the UTF-8
      encoding of the characters...
      <http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:encodeURIComponent>

      There's encodeURI thet seems to do the same job, and also encodes in UTF-8.

      So it seems you've got no way client side to URL-encode in a charset
      that you choose... You'll have to make your server side code correctly
      handle utf-8 encoded query strings...
    • Thomas Chille
      thanks a lot! now, this works great for me on the server side: [php] $var = utf8_decode(urldecode($_POST[ varname ])); [/php] lg t ... thanks a lot! now, this
      Message 2 of 2 , Dec 1, 2006
      • 0 Attachment
        thanks a lot!

        now, this works great for me on the server side:

        [php]
        $var = utf8_decode(urldecode($_POST['varname']));
        [/php]

        lg t

        On 12/1/06, Pierre Goiffon <pgoiffon@...> wrote:

        ----- Message de thomas.chille@... ---------
        Date : Thu, 30 Nov 2006 20:52:36 +0100
        De : Thomas Chille <thomas.chille@...>
        Répondre à : ydn-javascript@yahoogroups.com
        Objet : [ydn-javascript] Problem with encodeURIcomponent in
        Connection Manager
        À : ydn-javascript@yahoogroups.com

        > 'ä' should be '%E4' and not ''%C3%A4'
        (...)
        > i wanna send form data via the Connection Manager to the server.
        > special german chars from the charset ISO-8859-1should be url encoded
        > before. for this the Connection Manager is allways calling the buildin
        > JS function encodeURIcomponent for every form value.
        >
        > this call returns not the right string for me.
        >
        > normally the char 'ä' should be converted to '%E4' , but
        > encodeURIcomponent() is producing '%C3%A4'

        In ISO Latin-1 (8859-1), ä is encoded as E4
        In UTF-8, this same glyph is encoded as C3A4
        (you can check http://www.miakinen.net/vrac/charsets/ - sorry french
        webpage, but I think you'll undestand quickly what you'll see)

        In DevMo the encodeURIcomponent is said to always sends back the UTF-8
        encoding of the characters...
        <http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Functions:encodeURIComponent >

        There's encodeURI thet seems to do the same job, and also encodes in UTF-8.

        So it seems you've got no way client side to URL-encode in a charset
        that you choose... You'll have to make your server side code correctly
        handle utf-8 encoded query strings...


      Your message has been successfully submitted and would be delivered to recipients shortly.