So i want to save all of the output in my file to a .prc file. I am using ob_start(); and ob_get_contents(); to do this, so all of the echo's in the script are then stored into this file. The file needs a header and a footer, they are attached below, and they have special characters in them. When saved into the prc format, these special characters need to be as are written into the script, but they are changed. Here is an example of what I have going:
<?php
ob_start();
$header = "SMHMü«∂Mü«∂BOOKMOBI‡
XX*X:XJXZXjXzXäX öX
™X∫X X
ŒöŒúŒ¿ŒÏƒB
MOBIˉ¢Bˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇp PˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇEXTHx,:Ä æÙÌÏÔ@î@ì@ô@ò@ú@ùÃÕŒœ)SMH<html><head><guide></guide></head><body>";
echo $header;
$body = "Hello";
$footer ="<mbp:pagebreak/></body></html>FLISAˇˇˇˇˇˇˇˇFCISƒB Èé";
echo $footer;
$out = ob_get_contents();
ob_end_clean();
$file = fopen("smh.prc","w");
file_put_contents("smh.prc",$out);
fclose($file);
?>
This script works, and creates the .prc file, though when i look at the prc code, the header is this rather than what was in the script:
SMHMü«∂Mü«∂BOOKMOBI‡
XX*X:XJXZXjXzXäX öX
™X∫X XŒöŒúŒ¿ŒÏƒBMOBIˉ¢Bˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇp PˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇˇEXTHx,:Ä æÙÌÏÔ@î@ì@ô@ò@ú@ùÃÕŒœ
A similar thing has happened in the footer. How can i make an exception for these, and save the characters as the special characters, rather than these replacements? I am not sure what encoding these characters are from.