| 389 | | static int change_attachment_charset (BODY *b) |
| 390 | | { |
| 391 | | char buff[SHORT_STRING]; |
| 392 | | iconv_t cd; |
| 393 | | |
| 394 | | if (!mutt_is_text_type (b->type, b->subtype)) |
| 395 | | { |
| 396 | | mutt_error _("Can't change character set for non-text attachments!"); |
| 397 | | return 0; |
| 398 | | } |
| 399 | | |
| 400 | | mutt_get_send_charset (buff, sizeof(buff), b, 0); |
| 401 | | |
| 402 | | if (mutt_get_field (_("Enter character set: "), buff, sizeof(buff), 0) == -1) |
| 403 | | return 0; |
| 404 | | |
| 405 | | if ((cd = mutt_iconv_open (buff, "us-ascii")) == (iconv_t)-1) |
| 406 | | { |
| 407 | | mutt_error (_("Character set %s is unknown."), buff); |
| 408 | | return 0; |
| 409 | | } |
| 410 | | else |
| 411 | | iconv_close (cd); |
| 412 | | |
| 413 | | mutt_set_body_charset (b, buff); |
| 414 | | return REDRAW_CURRENT; |
| 415 | | } |