request_resize() needs to call term_size() to tell the terminal emulator
[u/mdw/putty] / unix / uxucs.c
index 928acae..5b21149 100644 (file)
@@ -97,13 +97,16 @@ int wc_to_mb(int codepage, int flags, wchar_t *wcstr, int wclen,
        return n;
     } else {
        return charset_from_unicode(&wcstr, &wclen, mbstr, mblen, codepage,
-                                   NULL, NULL, 0);
+                                   NULL, defchr?defchr:NULL, defchr?1:0);
     }
 }
 
-void init_ucs(int font_charset)
+/*
+ * Return value is TRUE if pterm is to run in direct-to-font mode.
+ */
+int init_ucs(char *linecharset, int font_charset)
 {
-    int i;
+    int i, ret = 0;
 
     /*
      * In the platform-independent parts of the code, font_codepage
@@ -117,9 +120,9 @@ void init_ucs(int font_charset)
      * line_codepage should be decoded from the specification in
      * cfg.
      */
-    line_codepage = charset_from_mimeenc(cfg.line_codepage);
+    line_codepage = charset_from_mimeenc(linecharset);
     if (line_codepage == CS_NONE)
-       line_codepage = charset_from_xenc(cfg.line_codepage);
+       line_codepage = charset_from_xenc(linecharset);
 
     /*
      * If line_codepage is _still_ CS_NONE, we assume we're using
@@ -131,6 +134,9 @@ void init_ucs(int font_charset)
     if (line_codepage == CS_NONE)
        line_codepage = font_charset;
 
+    if (line_codepage == CS_NONE)
+       ret = 1;
+
     /*
      * Set up unitab_line, by translating each individual character
      * in the line codepage into Unicode.
@@ -206,4 +212,6 @@ void init_ucs(int font_charset)
        else
            unitab_ctrl[i] = 0xFF;
     }
+
+    return ret;
 }