Matias
Matias

Reputation: 21

SAFARI URL encoding

The question is pretty simple but is driving me crazy. Using Safari 5+

<?
header('Content-Type:text/html; charset=UTF-8');
header('Location: http://www.mywebsite.es/?parametersandapipe|' ); 
?>

The destination URL is encoded to http://www.mywebsite.es/?parametersandapipe%7C

Is there a way to prevent Safari to encode characters ??

Thanks,

Upvotes: 2

Views: 2768

Answers (1)

Evan Mulawski
Evan Mulawski

Reputation: 55334

You should encode the URL strings before using them:

header('Location: ' . urlencode("http://www.mywebsite.es/?parametersandapipe|") );

To parse it afterward, use:

$query_string = urldecode($_SERVER['QUERY_STRING']);

This will ensure that all characters will be "unescaped."

Upvotes: 1

Related Questions