Why are URL encoded values in $_GET variables broken? I'm working with a payment gateway that returns payment feedback in the URL. One of the variables has a special character in it:

PM=Sofort+%DCberweisung


The %DC is Ü. However, it's coming through instead as �—and in case that doesn't display properly here, it's a black triangle with a question mark inside it. I confirmed this by replacing my menu callback with a simple print and die:

print($_GET['PM']); die();


The output is just (again: I'm not sure how that broken character might appear here on StackExchange):

Sofort �berweisung (DE)


I have confirmed that if I replace the %DC in the URL with Ü, it prints fine, so it's not a problem with that character: something is going wrong, somewhere, when the server tries to decode the URL-encoded value.

Does Drupal do any kind of processing on $_GET variables during bootstrapping? Could this be an Apache configuration issue?

Update: This is definitely something in Drupal. I moved my print-then-die to the very beginning of index.php and it prints the correct value. This tells me that it's not an Apache problem. Then, on a clean D6 install with no contrib modules, I added a small module that just adds a single menu callback to do that same print-then-die, and I got the invalid character there.
Sounds like your incoming data is ISO-8859-1, not the other way round. Drupal is always in UTF-8 (and utf8_encode converts from ISO-8859-1 to UTF8).

This is what I get when urlencoding Ü.:

$ drush ev 'var_dump(urlencode('ü'));'
string(6) "%C3%BC"


And when urldecoding and utf8 encoding %DC:

$ drush ev "var_dump(utf8_encode(urldecode('%DC')));"
string(2) "Ü"


Makes all perfect sense to me.