int iswprint (wint_t wc)
{
- return ((0x20 <= wc && wc < 0x7f) || 0xa0 <= wc);
+ if (Charset_is_utf8)
+ return ((0x20 <= wc && wc < 0x7f) || 0xa0 <= wc);
+ else
+ return (0 <= wc && wc < 256) ? IsPrint(wc) : 0;
}
-#endif /* HAVE_MBYTE */
+#endif /* !HAVE_WC_FUNCS */
#if !defined(HAVE_MBYTE) || !defined(HAVE_ICONV)
#define _MBYTE_H
void mutt_set_charset (char *charset);
+extern int Charset_is_utf8;
size_t utf8rtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *_ps);
* Markus Kuhn -- 2000-02-08 -- public domain
*/
+/* Adapted for Mutt by Edmund Grimley Evans.
+ * wcwidth() now refers to Charset_is_utf8.
+ */
+
#include "mutt.h"
#include "mbyte.h"
int max = sizeof(combining) / sizeof(struct interval) - 1;
int mid;
- /* test for 8-bit control characters */
if (ucs == 0)
return 0;
+
+ /* non-UCS case */
+ if (!Charset_is_utf8) {
+ if (0 <= ucs && ucs < 256)
+ return IsPrint(wc) ? 1 : -1;
+ else
+ return -1;
+ }
+
+ /* test for 8-bit control characters */
if (ucs < 32 || (ucs >= 0x7f && ucs < 0xa0))
return -1;