Welcome Guest, Not a member yet? Register   Sign In
URL-encoding in redirect?
#1

[eluser]Christoffer[/eluser]
Hey,

I am building a search function and I need to create easy to read URLs for bookmarks etc. This is a Swedish application first which means we need to support some special characters (å, ä, ö) that are not supported in URLs.

Therefore I need to encode the variable before it's posted to the user. The PHP function rawurlencode() works when I print the variable with echo() but neither redirect() nor header("Location: x") uses the encoded value.

Why is this and how can I work around it?

Code:
<?php
  // THIS WORKS!: echo rawurlencode((string)$query);
  $keyword = rawurlencode((string)$query);

  // This won't
  redirect('/search/' . $keyword );
?>

Thank you!


Messages In This Thread
URL-encoding in redirect? - by El Forum - 06-11-2009, 03:36 AM
URL-encoding in redirect? - by El Forum - 06-11-2009, 04:15 AM
URL-encoding in redirect? - by El Forum - 06-11-2009, 05:31 AM
URL-encoding in redirect? - by El Forum - 06-11-2009, 05:45 AM
URL-encoding in redirect? - by El Forum - 06-11-2009, 07:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB