+#if USE_WIDEC_SUPPORT
+ /*
+ * If the output contains "wide" (multibyte) characters, we will not
+ * really know the width of a character until we get the last byte
+ * of the character. Since the preceding byte(s) may use more columns
+ * on the screen than the final character, it is best to route the
+ * call to the wins_nwstr() function.
+ */
+ if (sp->_screen_unicode) {
+ size_t nn = (n > 0) ? (size_t) n : strlen(s);
+ wchar_t *buffer = typeMalloc(wchar_t, nn + 1);
+ if (buffer != 0) {
+ mbstate_t state;
+ size_t n3;
+ init_mb(state);
+ n3 = mbstowcs(buffer, s, nn);
+ if (n3 != (size_t) (-1)) {
+ code = wins_nwstr(win, buffer, (int) n3);
+ }
+ free(buffer);
+ }
+ }
+ if (code == ERR)
+#endif
+ {
+ NCURSES_SIZE_T oy = win->_cury;
+ NCURSES_SIZE_T ox = win->_curx;
+ const unsigned char *cp;