4 Replies Latest reply on Dec 30, 2009 6:12 AM by Dirk Becker

    socket connection: no utf-8 characters?

    Dr. TYPO Level 1

      Hello everyone,

       

      I have the following problem:

      - I connect to a webserver via socket connection from InDesign in order to read the website.

      - the document that I read is a php page

      - the content i read is utf-8 encoded

      - unfortunately the utf-8 characters are truncated in my result

       

      --> WHY? Any idea is welcome!

       

       

      Here are the scripts which I'm using:

       

      First the php script on the server:

       

      <?php
      header("Content-Type: text/html; charset=utf-8");
      echo "Motörhead";
      ?>

       

       

      Now the ExtendScript:

       

      Result = "";
      Connection = new Socket;

       


      if (Connection.open ("localhost:80")) {
          Connection.write ("GET /test.php HTTP/1.0 \n\n");
          Result = Connection.read(999999);
          Connection.close();
          }

       

      var myDocument = app.documents.add();
      var myTextFrame = myDocument.pages.item(0).textFrames.add();
      myTextFrame.geometricBounds = ["0mm", "0mm", "100mm", "100mm"];
      myTextFrame.contents = Result;

       

       

      And finally the result in my layout document:

       

      HTTP/1.1 200 OK
      Date: Wed, 30 Dec 2009 09:34:32 GMT
      Server: Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0
      X-Powered-By: PHP/5.3.0
      Content-Length: 9
      Connection: close
      Content-Type: text/html; charset=utf-8

      Motrhead

       

       

      As you can see, the character "ö" in the last line has been swallowed.

       

      What's wrong here?

       

      Thanks for you help in andvance,

       

      Dr. TYPO