Twilio / PHP - 如何正确编码和解码URL?

I have a variable:

$name = urlencode('é');

which is being called by Twilio:

array("url" => "example.com/test1.php?name=$name")

In test1.php, my TwiML looks like:

<Response> 
    <Gather numDigits="1" method="GET" action="example.com/test2.php?name=<?php echo urlencode($_GET["name"]);?>>
        <Say>Hello,<?php echo urldecode($name);?></Say>
        <Say>To repeat press 1. To confirm, press 2.</Say>
    </Gather>
</Response>

If I don't encode the $_GET["name"] in action, I get an application error "HTTP retrieval failure". I'm not sure why because shouldn't it already be encoded? Why is it showing the decoded é in the message, resulting in the error?

Another problem I'm having is echo $_GET["name"]; and echo urldecode($_GET["name"]); both print é instead of é in test2.php.

Lastly, to handle the repeat, should my redirect link in test2.php back to test1.php contain urlencoding for $_GET["name"]?

<Redirect>
    example.com/test1.php?name=<?php echo urlencode($_GET["name"]);?
</Redirect>

I can probably figure this one out if I know how to fix my first 2 problems.