PHP setcookie中文

PHP代码

<?php  
header("Content-type: text/html; charset=utf-8");  
$username = '测试';
setrawcookie('username', $username, time() + 365*24*3600);  

JS中使用

decodeURIComponent(document.cookie)