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

Re: How to Connection.setForm() encode in utf-8

Expand Messages
  • jeremymefford
    So I finally found out what I needed to do. I m not quite sure exactly what the difference is between this and what I was trying to do earlier... I get
    Message 1 of 4 , May 1, 2008
    • 0 Attachment
      So I finally found out what I needed to do. I'm not quite sure
      exactly what the difference is between this and what I was trying to
      do earlier... I get confused when trying to send strange characters in
      the request. In any case, here's the code that I ended up with and it
      works like a charm.


      generatePostData: function(eForm) {
      var aElements = eForm.elements;
      var sPostData = "";
      for (var iter = 0;iter < aElements.length;iter++) {
      var currElement = aElements[iter];
      if (currElement.name) {
      if (currElement.name != "") {
      if (sPostData != "") {
      sPostData += "&";
      }
      sPostData += currElement.name + "=" +
      escape(currElement.value);
      }
      }
      }
      return sPostData;
      },

      Thanks for your help though.

      Best-
      Jeremy

      --- In ydn-javascript@yahoogroups.com, "jeremymefford"
      <jeremymefford@...> wrote:
      >
      > Hi all-
      >
      > I'm having some difficulty with the connection.setForm() method. It's
      > encoding my form via ISO-8859-1 instead of utf-8. I did:
      >
      > connection.initHeader("Content-Type","text/html; charset=utf-8");
      >
      > and that didn't do anything. Also, the page that the form is on has a
      > <meta> tag defining it as UTF-8. Any help is greatly appreciated!
      >
      > Thanks-
      > Jeremy
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.