*** rxvt-2.4.7/src/screen.c	1998/08/28 01:29:13	1.10
--- rxvt-2.4.7/src/screen.c	1999/01/27 07:43:10	1.11
***************
*** 29,35 ****
   */
  
  #ifndef lint
! static const char rcsid[] = "$Id: screen.c,v 1.10 1998/08/28 01:29:13 mason Exp $";
  #endif
  
  #include "rxvt.h"		/* NECESSARY */
--- 29,35 ----
   */
  
  #ifndef lint
! static const char rcsid[] = "$Id: screen.c,v 1.11 1999/01/27 07:43:10 czyborra Exp $";
  #endif
  
  #include "rxvt.h"		/* NECESSARY */
***************
*** 1990,1998 ****
      if (currmaxcol < TermWin.ncol) {
  	currmaxcol = TermWin.ncol;
  	if (buffer)
! 	    buffer = REALLOC(buffer, (sizeof(char) * (currmaxcol + 1)));
  	else
! 	    buffer = MALLOC((sizeof(char) * (currmaxcol + 1)));
      }
      row_offset = TermWin.saveLines - TermWin.view_start;
      fprop = TermWin.fprop;
--- 1990,1998 ----
      if (currmaxcol < TermWin.ncol) {
  	currmaxcol = TermWin.ncol;
  	if (buffer)
! 	    buffer = REALLOC(buffer, (sizeof(XChar2b) * (currmaxcol + 1)));
  	else
! 	    buffer = MALLOC((sizeof(XChar2b) * (currmaxcol + 1)));
      }
      row_offset = TermWin.saveLines - TermWin.view_start;
      fprop = TermWin.fprop;
***************
*** 2055,2060 ****
--- 2055,2096 ----
  	srp = screen.rend[scrrow];
  	dtp = drawn_text[row];
  	drp = drawn_rend[row];
+ 
+ #ifdef UTF8
+ 	for (col = wlen = 0; col < TermWin.ncol; col++) {
+ 
+ 	  if (stp[col] >> 5 == 6 &&
+ 	      col < TermWin.ncol - 1 &&
+ 	      stp[col+1] >> 6 == 2)
+ 	    {
+ 	      /* 110wwwvv 10vvvvvv */
+ 	      buffer[wlen] = stp[col] >> 2 & 0x07;
+ 	      buffer[++wlen] = stp[col] << 6;
+ 	      buffer[wlen++] |= stp[++col] & 0x3F;
+ 	    }
+ 	  else if (stp[col] >> 4 == 14 &&
+ 		   col < TermWin.ncol - 2 &&
+ 		   stp[col+1] >> 6 == 2 &&
+ 		   stp[col+2] >> 6 == 2)
+ 	    {
+ 	      /* 1110wwww 10wwwwvv 10vvvvvv */
+ 	      buffer[wlen] = stp[col] << 4;
+ 	      buffer[wlen] |= stp[++col] >> 2 & 0x0F;
+ 	      buffer[++wlen] = stp[col] << 6;
+ 	      buffer[wlen++] |= stp[++col] & 0x3F;
+ 	    }
+ 	  else
+ 	    {
+ 	      buffer[wlen++] = 0x00;
+ 	      buffer[wlen++] = stp[col];
+ 	    }
+ 	}
+ 	CLEAR_CHARS(Col2Pixel(0), Row2Pixel(row), TermWin.ncol);
+ 	DRAW_STRING(XDrawImageString16, 
+ 		    Col2Pixel(0), Row2Pixel(row) + TermWin.font->ascent, 
+ 		    (XChar2b*) buffer, wlen >> 1);
+ #else
+ 
  #ifndef NO_BOLDOVERSTRIKE
  /*
   * Bold Overstrike pixel dropping avoidance.
***************
*** 2361,2366 ****
--- 2397,2403 ----
  		XChangeGC(Xdisplay, TermWin.gc, gcmask, &gcvalue);
  	    }
  	}
+ #endif /*UTF8*/
      }
      row = screen.row + TermWin.saveLines;
      col = screen.col;
