title: Encoding problems (special characters): Apache mod_rewrite -> PHP GET -> XML file name and tags
body: <p>I'm trying to write a rule for mod_rewrite that does the following:
  URL: <code>/xml/regularString</code> redirected to <code>/xml/script.php?code=regularString</code></p>
  
  <p>This works very well with a simple rule such as:</p>
  
  <pre><code>RewriteRule ^xml/([A-Za-z0-9-]+)/?$ xml/script.php?code=$1 [NC]
  </code></pre>
  
  <p>(On a side note: Why is the <code>?</code> important? I don't want there to be any optional redirection/match, but if I remove it it doesn't work)</p>
  
  <p>Anyway... I mostly need to redirect even very uncommon special characters in the same manner, but if I try to extend the rule, it'll simply not match = 404, or it will jumble them so that the PHP script can't even be accessed because of something like this (error log):</p>
  
  <p>404 etc... <code>/xml/]*\xc2\xb0_\xc2\xb0*[</code></p>
  
  <p>and the rule</p>
  
  <p><code>RewriteRule ^/xml/([A-Za-z0-9-*°&gt;&lt;_]+/?$</code> ... etc; with or without escaping them (via )</p>
  
  <p>(This was supposed to be: <code>URL /xml/&gt;*°_°*&lt;</code> redirected to <code>/xml/script.php?code=  &gt; *°_°*&lt;</code> (or some other encoding I can then decode in PHP to obtain the same result)</p>
  
  <p>How can I make sure the mod_rewrite always finds the php script and redirect the code to it? I can figure out how to un-jumble it in PHP but not in those RewriteRules, I'm afraid. I tried flags such as <code>[B]</code> or <code>[NE]</code> that, in the documentation, were used to change the escape behaviour of mod_rewrite, but it didn't get any better than 404 with the aforementioned error log entry.</p>