Show
Ignore:
Timestamp:
2000-05-09 08:19:26 (9 years ago)
Author:
Thomas Roessler <roessler@…>
Branch:
HEAD
Message:

Edmund Grimley Evans' UTF-8 patch.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • compose.c

    r1601 r1716  
    2727#include "sort.h" 
    2828#include "charset.h" 
     29#include "iconv.h" 
    2930 
    3031#ifdef MIXMASTER 
     
    6869 
    6970#define HDR_XOFFSET 10 
    70 #define TITLE_FMT "%10s" 
     71#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ 
    7172#define W (COLS - HDR_XOFFSET) 
    7273 
     
    278279  buf[0] = 0; 
    279280  rfc822_write_address (buf, sizeof (buf), addr); 
    280   mvprintw (line, 0, TITLE_FMT "%-*.*s", Prompts[line - 1], W, W, buf); 
     281  mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]); 
     282  mutt_paddstr (W, buf); 
    281283} 
    282284 
     
    287289  draw_envelope_addr (HDR_CC, msg->env->cc); 
    288290  draw_envelope_addr (HDR_BCC, msg->env->bcc); 
    289   mvprintw (HDR_SUBJECT, 0, TITLE_FMT "%-*.*s", Prompts[HDR_SUBJECT - 1], W, W, 
    290             NONULL(msg->env->subject)); 
     291  mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); 
     292  mutt_paddstr (W, NONULL (msg->env->subject)); 
    291293  draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); 
    292   mvprintw (HDR_FCC, 0, TITLE_FMT "%-*.*s", Prompts[HDR_FCC - 1], W, W, fcc); 
     294  mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]); 
     295  mutt_paddstr (W, fcc); 
    293296 
    294297 
     
    332335  buf[0] = 0; 
    333336  rfc822_write_address (buf, sizeof (buf), *addr); 
    334   mvprintw (line, HDR_XOFFSET, "%-*.*s", W, W, buf); 
     337  move (line, HDR_XOFFSET); 
     338  mutt_paddstr (W, buf); 
    335339 
    336340  return 0; 
     
    386390{ 
    387391  char buff[SHORT_STRING]; 
     392  iconv_t cd; 
    388393 
    389394  if (!mutt_is_text_type (b->type, b->subtype)) 
     
    397402  if (mutt_get_field (_("Enter character set: "), buff, sizeof(buff), 0) == -1) 
    398403    return 0; 
    399      
    400   if (mutt_is_utf8(buff)) 
    401   { 
    402     if (!b->noconv) 
    403     { 
    404       mutt_error (_("UTF-8 encoding attachments has not yet been implemented.")); 
    405       return 0; 
    406     } 
    407   } 
    408   else if (mutt_get_charset (buff) == NULL) 
     404 
     405  if ((cd = iconv_open (buff, "us-ascii")) == (iconv_t)-1) 
    409406  { 
    410407    mutt_error (_("Character set %s is unknown."), buff); 
    411408    return 0; 
    412409  } 
     410  else 
     411    iconv_close (cd); 
    413412   
    414413  mutt_set_body_charset (b, buff); 
     
    489488          clrtoeol (); 
    490489          if (msg->env->subject) 
    491             printw ("%-*.*s", W, W, msg->env->subject); 
     490            mutt_paddstr (W, msg->env->subject); 
    492491        } 
    493492        break; 
     
    501500          strfcpy (fcc, buf, _POSIX_PATH_MAX); 
    502501          mutt_pretty_mailbox (fcc); 
    503           mvprintw (HDR_FCC, HDR_XOFFSET, "%-*.*s", W, W, fcc); 
     502          move (HDR_FCC, HDR_XOFFSET); 
     503          mutt_paddstr (W, fcc); 
    504504          fccSet = 1; 
    505505        } 
     
    766766          break; 
    767767        } 
    768         if (mutt_is_utf8 (mutt_get_parameter ("charset", CURRENT->parameter))) 
    769         { 
    770           mutt_error (_("We currently can't encode to utf-8.")); 
    771           break; 
    772         } 
    773768        CURRENT->noconv = !CURRENT->noconv; 
    774769        if (CURRENT->noconv)