I have the following piece of code which I partly got from another thread in SO:
<?php
header('Content-Type: text/html; charset=ISO-8859-1');
$origadd = $_SESSION["OriginAdd"] // $_SESSION["OriginAdd"] has a value "rueFrédéricMistral";
echo $origadd; // This displays rueFrédéricMistral
?>
<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
var source = <?php echo json_encode($origadd); ?>;
alert(source); // This displays null
</script>
</head>
....
....
</html>
As I have mentioned in the comments, the echo statement gives me the original string. However, the alert box in JS gives me a null value because of which the subsequent code is failing.