diff -uNr jfbterm-0.4.7.orig/Makefile.am jfbterm-0.4.7/Makefile.am
--- jfbterm-0.4.7.orig/Makefile.am	2003-09-14 05:58:53.000000000 +0900
+++ jfbterm-0.4.7/Makefile.am	2005-12-01 08:48:01.000000000 +0900
@@ -14,7 +14,7 @@
 		util.c util.h \
 		csv.c csv.h \
 		vterm.c vtermlow.c vterm.h
-jfbterm_LDADD = -lutil
+jfbterm_LDADD = -lutil -lhangul
 
 JFBTERM_CONFIG_FILE = jfbterm.conf.sample
 
diff -uNr jfbterm-0.4.7.orig/Makefile.in jfbterm-0.4.7/Makefile.in
--- jfbterm-0.4.7.orig/Makefile.in	2003-09-14 05:58:53.000000000 +0900
+++ jfbterm-0.4.7/Makefile.in	2005-12-01 08:57:10.000000000 +0900
@@ -71,7 +71,7 @@
 bin_PROGRAMS = jfbterm
 jfbterm_SOURCES =  		main.c main.h 		mytypes.h sequence.h 		fbcommon.c fbcommon.h 		fbdpsp.c fbdpsp.h 		font.c font.h 		picofont.c picofont.h 		getcap.c getcap.h 		message.c message.h 		pcf.c pcf.h 		pen.c pen.h 		term.c term.h 		util.c util.h 		csv.c csv.h 		vterm.c vtermlow.c vterm.h
 
-jfbterm_LDADD = -lutil
+jfbterm_LDADD = -lutil -lhangul
 
 JFBTERM_CONFIG_FILE = jfbterm.conf.sample
 
@@ -83,7 +83,7 @@
 PROGRAMS =  $(bin_PROGRAMS)
 
 
-DEFS = @DEFS@ -I. -I$(srcdir) -I.
+DEFS = @DEFS@ -I. -I$(srcdir) -I. -I/usr/include/hangul-1.0 -DJFB_USE_LIBHANGUL
 CPPFLAGS = @CPPFLAGS@
 LDFLAGS = @LDFLAGS@
 LIBS = @LIBS@
diff -uNr jfbterm-0.4.7.orig/main.c jfbterm-0.4.7/main.c
--- jfbterm-0.4.7.orig/main.c	2004-05-11 03:03:44.000000000 +0900
+++ jfbterm-0.4.7/main.c	2005-12-01 09:32:18.000000000 +0900
@@ -47,6 +47,9 @@
 #include <locale.h>
 #include <langinfo.h>
 #include <iconv.h>
+#ifdef JFB_USE_LIBHANGUL
+#include <hangul.h>
+#endif
 
 #include "pcf.h"
 #include "font.h"
@@ -65,6 +68,11 @@
 #else
 #define	FILE_JFBTERM_CONF	"/etc/jfbterm.conf"
 #endif
+#ifdef JFB_USE_LIBHANGUL
+int keyboard = HANGUL_KEYBOARD_2;
+HangulInputContext *hic;
+int use_libhangul = 1;
+#endif
 
 TFrameBufferMemory gFramebuffer;
 
@@ -435,6 +443,13 @@
 	if (!tn) {
 		tn = "jfbterm";
 	}
+#ifdef JFB_USE_LIBHANGUL
+	hic = hangul_ic_new(keyboard);
+	if(hic == NULL) {
+		print_message("\nlibhangul error: Can't create HangulInputContext\n");
+		use_libhangul = 0;
+	}
+#endif
 	tterm_start(&gTerm, tn, en);
 
 	tfbm_close(&gFramebuffer);
diff -uNr jfbterm-0.4.7.orig/term.c jfbterm-0.4.7/term.c
--- jfbterm-0.4.7.orig/term.c	2003-09-16 00:45:31.000000000 +0900
+++ jfbterm-0.4.7/term.c	2005-12-01 09:41:40.000000000 +0900
@@ -44,6 +44,10 @@
 #include <pty.h>
 #include <utmp.h>
 #include <grp.h>
+#ifdef JFB_USE_LIBHANGUL
+#include <wchar.h>
+#include <hangul.h>
+#endif
 
 #include "term.h"
 #include "vterm.h"
@@ -58,6 +62,17 @@
 int gChildProcessId = 0;
 
 TTerm gTerm;
+#ifdef JFB_USE_LIBHANGUL
+extern int keyboard;
+extern int use_libhangul;
+extern HangulInputContext *hic;
+
+u_char commit[32] = {'\0', };
+wchar_t *commit_wcs;
+
+u_char preedit[32] = {'\0', };
+wchar_t *preedit_wcs;
+#endif
 
 void tterm_wakeup_shell(TTerm* p, const char* tn);
 void tterm_final(TTerm* p);
@@ -111,6 +126,9 @@
 	write(1, "\x1B[?25h", 6);
 */
 	tcsetattr(0, TCSAFLUSH, &(p->ttysave));
+#ifdef JFB_USE_LIBHANGUL
+	hangul_ic_delete(hic);
+#endif
 	tterm_final(p);
 
 	tfbm_close(&gFramebuffer);
@@ -126,6 +144,14 @@
 	}
 	return 1;
 }
+#ifdef JFB_USE_LIBHANGUL
+int get_shift_state(void)
+{
+	int na = 6, ns = 0;
+	if(ioctl(fileno(stdin), TIOCLINUX, &na) == 0) ns = na;
+	return ns;
+}
+#endif
 
 #define BUF_SIZE 1024
 void tterm_start(TTerm* p, const char* tn, const char* en)
@@ -141,6 +167,12 @@
 	int tfbm_set_blank(int, int);
 #  define DIMMER_TIMEOUT (3 * 60 * 10)        /* 3 min */
 #endif
+#ifdef JFB_USE_LIBHANGUL
+	u_int hangul_state = 0;
+	u_int preedit_after_commit = 0;
+	u_int i, n, c, have_preedit = 0;
+	u_int preedit_len = 0;
+#endif
 
 	tterm_init(p, en);
 	if (!tterm_get_ptytty(p)) {
@@ -216,7 +248,108 @@
 			}
 #endif
 			if (ret > 0) {
+#ifdef JFB_USE_LIBHANGUL
+if(use_libhangul) {
+	/* TODO: hanja conversion support here */
+	if(buf[0] == '\033' && hangul_state == 1) {
+		/*
+		 * escape key or sequence
+		 * - flush/commit and go on with regular processing
+		 */
+		hangul_ic_flush(hic);
+		{
+			commit_wcs = (wchar_t *)hangul_ic_get_commit_string(hic);
+			if(wcstombs(commit, commit_wcs, sizeof(commit)) < 0) {
+				; // XXX
+			}
+			if(strlen(commit) > 0) {
+				write(p->ptyfd, commit, strlen(commit));
+				preedit_after_commit = 1;
+			}
+		}
+		hangul_state = 0;
+	}
+	if(ret == 1 && buf[0] == ' ' && get_shift_state()) {
+		/*
+		 * shift-space Hangul/English toggle
+		 * (TODO: support for keys other than shift-space?)
+		 */
+		if(hangul_state == 1) {
+			hangul_ic_flush(hic);
+			{
+				commit_wcs = (wchar_t *)hangul_ic_get_commit_string(hic);
+				if(wcstombs(commit, commit_wcs, sizeof(commit)) < 0) {
+					; // XXX
+				}
+				if(strlen(commit) > 0) {
+					write(p->ptyfd, commit, strlen(commit));
+					// we won't have anything to preedit...
+				}
+			}
+			hangul_state = 0;
+		}
+		else hangul_state = 1;
+	}
+	else if(hangul_state) {
+		/*
+		 * preedit processing divides into two groups
+		 *  (case 1) no commit, only preedit
+		 *  (case 2) commmit and (then) preedit
+		 * with the first case, there is no problem; we can show preedit chars
+		 * as soon as we process them, however with the second case, we need to
+		 * show the preedit chars AFTER we commit, so we need to handle these
+		 * two cases separately.
+		 */
+		for(i = 0; i < ret; i++) {
+			/* handle commit */
+			c = buf[i];
+			have_preedit = hangul_ic_filter(hic, c);
+			{
+				commit_wcs = (wchar_t *)hangul_ic_get_commit_string(hic);
+				if(wcstombs(commit, commit_wcs, sizeof(commit)) < 0) {
+					; // XXX
+				}
+				if(strlen(commit) > 0) {
+					write(p->ptyfd, commit, strlen(commit));
+					preedit_after_commit = 1;
+				}
+			}
+			if(have_preedit == 0) {
+				write(p->ptyfd, &c, 1);
+			}
+		}
+		if(have_preedit == 1) {
+			/* handle preedit (case 1) */
+			preedit_wcs = (wchar_t *)hangul_ic_get_preedit_string(hic);
+			n = wcstombs(preedit, preedit_wcs, sizeof(preedit));
+			/* XXX: commit !EUC-KR chars in EUC-KR locale (n < 0) */
+			preedit_len = strlen(preedit);
+			if(preedit_after_commit == 0) {
+				if(preedit_len == 0) {
+					/* XXX: (sigh) */
+					preedit[0] = ' ';
+					preedit[1] = ' ';
+					preedit[2] = 0;
+				}
+				else if(preedit_len > 0) {
+					tvterm_emulate(&(p->vterm), preedit, strlen(preedit));
+					p->vterm.pen.x -= 2;
+					tvterm_refresh(&(p->vterm));
+					preedit_len = 0;
+				}
+			}
+		}
+	}
+	else {
+		write(p->ptyfd, buf, ret);
+	}
+}
+else {
+	write(p->ptyfd, buf, ret);
+}
+#else
 				write(p->ptyfd, buf, ret);
+#endif
 			}
 		} else if (FD_ISSET(p->ptyfd,&fds)) {
 			ret = read(p->ptyfd, buf, BUF_SIZE);
@@ -224,6 +357,18 @@
 				/* write(1, buf, ret); */
 				tvterm_emulate(&(p->vterm), buf, ret);
 				tvterm_refresh(&(p->vterm));
+#ifdef JFB_USE_LIBHANGUL
+				if(preedit_after_commit == 1) {
+					if(preedit_len > 0) {
+						/* handle preedit (case 2) */
+						tvterm_emulate(&(p->vterm), preedit, strlen(preedit));
+						p->vterm.pen.x -= 2;
+						tvterm_refresh(&(p->vterm));
+						preedit_len = 0;
+					}
+					preedit_after_commit = 0;
+				}
+#endif
 			}
 		}
 	}
