<?php
$chinese_str = "你好hello";
$encoded = base64_encode($chinese_str);
?>
<script>
let str = "<?=$encoded ?>";
str = decodeURIComponent(atob(str).split('').map(function (c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
}).join(''));
alert(str);
</script>
网友回复