I've seen you fixed a core bug #371495: Error message from drupal_http_request() not UTF8 encoded I found a long time ago, but never solved in core:

<?php
   
// Convert error message to utf-8.
   
$errstr = iconv('utf-8', 'utf-8//IGNORE', $errstr);
?>

After more investigation I guess you should better use http://api.drupal.org/api/drupal/includes--unicode.inc/function/drupal_c... . This function shows that iconv() may not available and than it fallback to others.

Until now I'm using this logic in linkchecker:

  // @todo drupal_http_request() may not provide an UTF8 encoded error message
  // what results in a database UPDATE failure. For more information, see
  // http://drupal.org/node/371495.
  // Workaround: ISO-8859-1 as source encoding may be wrong, but WFM.
  if (!empty($response->error) && !drupal_validate_utf8($response->error)) {
    $response->error = drupal_convert_to_utf8($response->error, 'ISO-8859-1');
  }
Files: 

Comments

Status:Active» Fixed
StatusFileSize
new717 bytes

And so begins the code split. httprl 7.x and 6.x will no longer be an almost exact copy. oh well.

Patch below has been committed to 7.x only.

This is one, we can backport to D6 :-)

have httprl define drupal_convert_to_utf8() if it doesn't exist? yeah that can be done; but things start to get messy when you do that in a lot of places.

No... It's a core function - it always exist since D5... http://api.drupal.org/api/drupal/includes--unicode.inc/function/drupal_c...

Version:7.x-1.x-dev» 6.x-1.x-dev
Status:Fixed» Needs review

nice!

Status:Needs review» Fixed

patch applied to 6.x

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Issue summary:View changes

code filter is broken