Lines 484-490
Link Here
|
484 |
|
484 |
|
485 |
if (SOUP_STATUS_IS_SUCCESSFUL(message->status_code)) |
485 |
if (SOUP_STATUS_IS_SUCCESSFUL(message->status_code)) |
486 |
{ |
486 |
{ |
487 |
const char *charset = NULL; |
487 |
char *charset = NULL; |
488 |
|
488 |
|
489 |
if (flags & TRANSFER_CONVERT) |
489 |
if (flags & TRANSFER_CONVERT) |
490 |
{ |
490 |
{ |
Lines 493-506
Link Here
|
493 |
content_type = translate_generic_service_get_header(message, &info, "Content-Type"); |
493 |
content_type = translate_generic_service_get_header(message, &info, "Content-Type"); |
494 |
if (content_type) |
494 |
if (content_type) |
495 |
{ |
495 |
{ |
496 |
charset = translate_ascii_strcasestr(content_type, "charset="); |
496 |
const char *tmp; |
497 |
if (charset) |
497 |
|
498 |
charset += 8; |
498 |
tmp = translate_ascii_strcasestr(content_type, "charset="); |
|
|
499 |
if (tmp) |
500 |
{ |
501 |
int len; |
502 |
|
503 |
tmp += 8; |
504 |
if (*tmp == '\'' || *tmp == '"') |
505 |
tmp++; |
506 |
|
507 |
len = strlen(tmp); |
508 |
if (len > 0 && (tmp[len - 1] == '\'' || tmp[len - 1] == '"')) |
509 |
len--; |
510 |
|
511 |
charset = g_strndup(tmp, len); |
512 |
} |
499 |
} |
513 |
} |
500 |
} |
514 |
} |
501 |
|
515 |
|
502 |
if (charset) |
516 |
if (charset) |
503 |
response = g_convert(message->response.body, message->response.length, "UTF-8", charset, NULL, NULL, err); |
517 |
{ |
|
|
518 |
response = g_convert(message->response.body, message->response.length, "UTF-8", charset, NULL, NULL, err); |
519 |
g_free(charset); |
520 |
} |
504 |
else |
521 |
else |
505 |
{ |
522 |
{ |
506 |
if ((flags & TRANSFER_CONVERT) && ! g_utf8_validate(message->response.body, message->response.length, NULL)) |
523 |
if ((flags & TRANSFER_CONVERT) && ! g_utf8_validate(message->response.body, message->response.length, NULL)) |