Probá así:
Código PHP:
<?php
function js_encode($s){
$texto='';
$lon=strlen($s);
for($i=0;$i<$lon;++$i){
$num=ord($s[$i]);
if($num<16) $texto.='\x0'.dechex($num);
else $texto.='\x'.dechex($num);
}
return $texto;
}
$eventos_tipo_php= js_encode(implode("a",$mapa_eventos_tipo));
?>
<script type="text/javascript">
var evento_tipo= '<?php echo $eventos_tipo_php; ?>';
alert(evento_tipo);
</script>