- /*
- * The stuff we've just generated is assumed to be
- * ISO-8859-1! This sounds insane, but `man
- * XLookupString' agrees: strings of this type returned
- * from the X server are hardcoded to 8859-1. Strictly
- * speaking we should be doing this using some sort of
- * GtkIMContext, which (if we're lucky) would give us
- * our data directly in Unicode; but that's not
- * supported in GTK 1.2 as far as I can tell, and it's
- * poorly documented even in 2.0, so it'll have to
- * wait.
- */
- lpage_send(inst->ldisc, CS_ISO8859_1, output+start, end-start, 1);
+ if (!use_ucsoutput) {
+ /*
+ * The stuff we've just generated is assumed to be
+ * ISO-8859-1! This sounds insane, but `man
+ * XLookupString' agrees: strings of this type
+ * returned from the X server are hardcoded to
+ * 8859-1. Strictly speaking we should be doing
+ * this using some sort of GtkIMContext, which (if
+ * we're lucky) would give us our data directly in
+ * Unicode; but that's not supported in GTK 1.2 as
+ * far as I can tell, and it's poorly documented
+ * even in 2.0, so it'll have to wait.
+ */
+ lpage_send(inst->ldisc, CS_ISO8859_1, output+start,
+ end-start, 1);
+ } else {
+ /*
+ * We generated our own Unicode key data from the
+ * keysym, so use that instead.
+ */
+ luni_send(inst->ldisc, ucsoutput+start, end-start, 1);
+ }