1

I am trying my best to describe my problem. For a client PC, I am reading a file (Via ::ReadFile) and uploading i tto a PHP server (HTTP upload). I am receiving this string in that PHP via following file code and saving in hard disk:

<?php
// body contains sent data here
    $body = file_get_contents('php://input',FILE_TEXT);
    echo "<script language= 'JavaScript'>alert(' . $body . ');</script>";
        $today = date("dmY-Gis");
        $name = $today . ".log";
        //$body = utf8_encode($body);
        //$body = "\xEF\xBB\xBF".$body;
        $f = fopen($name, "wb");
        fwrite($f, $body);
        fclose($f);
php?>

Now, I have a string sending as follows: выфпвыфп Notepad

But this PHP script is saving it as ???????? Notepad

Seems english strings are captured correctly, but non - English string is not collected

Can any one have idea.

Above two are same problem but none gave any solutions that worked for me.

Community
  • 1
  • 1
  • 2
    Do you have a character encoding set in your document? – Waleed Khan Mar 12 '13 at 13:06
  • What encoding is the data sent in and what encoding are you trying to interpret it in? – deceze Mar 12 '13 at 13:07
  • As @WaleedKhan mentioned, try with or something similar on your document – aleation Mar 12 '13 at 13:21
  • The document which I am reading have Unicode, it fine, it is sending currect strings (I saw it from debuggung). But the out puts tring is in ANSII format. I tried to make it utf-8 using //$body = utf8_encode($body); //$body = "\xEF\xBB\xBF".$body; But it won't occured – debdipta Ghosh Mar 12 '13 at 13:59
  • [What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text](http://kunststube.net/encoding/) – deceze Mar 12 '13 at 15:29
  • Thanks deceze, it is awesome link – debdipta Ghosh Mar 18 '13 at 10:57

1 Answers1

0

add this

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">

to your page