将日文字符传递给PhP文件

I make a simple PhP program

<?php

echo $_GET['ID'];
?>

Then I call

http://localhost/testGetID/?ID=%E6%AD%A4%E5%8E%9F%E7%90%86%E6%98%AF%E5%9C%A8

This is what I got: æ­¤åŽŸç†æ˜¯åœ¨

What should I do so I show up actual chinese characters? The chinese characters will be ID for my databases by the way.

  1. add this line to your <head></head> section <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  2. use urldecode() or mb_convert_encoding() function

  3. encode the ID with base64_encode() and then decode it with base64_decode()

Can you try this?

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Test page</title>
</head>
Your php code/chinese characters go here.
<body>
</body>
</html>