<!DOCTYPE html>
<html>
<body>

<?php
// Variable to check
$url="http://www.w3schools��.com";

// Encode characters and remove all characters with ASCII value > 127
$url = filter_var($url, FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH);
echo $url;
?>
 

</body>
</html>