Jump to content

printf( ) html contains static russian charachers


evgenyvo

Recommended Posts

Hi All,

 

I'm trying to return HTML page contains the Russian characters sent as POST variables and also static data as part of HTML result.

 

I'm not able to put it work together.

 

If I set windows-1251 - the static data displayed incorrectly.

If I set UTF-8 - the dynamic (POST) data displayed incorrectly

 

Any thoughts?

 

Thank you very much in advance,

Evgeny 

 

Following is the simple HTML example and also Fiddler request example

<?php
header('Content-Type: text/html;charset=windows-1251');
 
$firstName = $_POST["from"];
$subject = $_POST["subject"];
$message = $_POST["message"];
$version = phpversion();
 
$messageToSend = "
<html>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1251'>
  <head>
    <title>Christiada2033 automatic email</title>
  </head>
  <body>
    <p>Static russian: По-русски</p>
    <table>
      <tr>
        <td>Version:</td>
        <td>$version
      </tr>
      <tr>
        <td>Static russian: Отправитель:</td>
        <td>Post value russian: $firstName</td>
      </tr>
      <tr>
        <td>Static russian: Тема:</td>
        <td>Post value russian: $subject</td>
      </tr>
      <tr>
        <td>Static russian: Сообщение:</td>
        <td>Post value russian: $message</td>
      </tr>
    </table>
  </body>
</html>
";
 
printf($messageToSend);
die();
?>
 
=====================Fiddler=====================
Host: myhost
Connection: keep-alive
Content-Length: 132
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/38.0.2125.111 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip,deflate
Accept-Language: en-GB,en;q=0.8,en-US;q=0.6,ru;q=0.4,he;q=0.2
 
from=%C8%E2%E0%ED+%CF%E5%F2%F0%EE%E2&subject=%D2%E5%EC%E0&message=%CF%F0%E8%E2%E5%F2%2C+%EF%F0%E8%E2%E5%F2%21&submit=Submit+Feedback
=====================Fiddler=====================
 
 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.