Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
// 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');
}
Comment | File | Size | Author |
---|---|---|---|
#1 | httprl-1419728-1-use-core-utf8-conversion.patch | 717 bytes | mikeytown2 |
Comments
Comment #1
mikeytown2 CreditAttribution: mikeytown2 commentedAnd 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.
Comment #2
hass CreditAttribution: hass commentedThis is one, we can backport to D6 :-)
Comment #3
mikeytown2 CreditAttribution: mikeytown2 commentedhave 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.
Comment #4
hass CreditAttribution: hass commentedNo... It's a core function - it always exist since D5... http://api.drupal.org/api/drupal/includes--unicode.inc/function/drupal_c...
Comment #5
mikeytown2 CreditAttribution: mikeytown2 commentednice!
Comment #6
mikeytown2 CreditAttribution: mikeytown2 commentedpatch applied to 6.x
Comment #7.0
(not verified) CreditAttribution: commentedcode filter is broken