summaryrefslogtreecommitdiff
path: root/test/utf8.cxx
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2009-09-17 20:40:02 +0000
committerMatthias Melcher <fltk@matthiasm.com>2009-09-17 20:40:02 +0000
commitc0e4cf48a402bc355558b7a99160da0659cfbfa2 (patch)
treeceddd45e7ed9e722f1d608cc3ed363346fe4cc92 /test/utf8.cxx
parent9ba790be3bfc78060a54ddc6038b887a8033a800 (diff)
Starting to allow international (unicode) keystrokes as shortcuts.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@6877 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/utf8.cxx')
-rw-r--r--test/utf8.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/utf8.cxx b/test/utf8.cxx
index 40eb12c90..ee418b44b 100644
--- a/test/utf8.cxx
+++ b/test/utf8.cxx
@@ -490,9 +490,10 @@ public:
case FL_DND_RELEASE: return 1;
case FL_PASTE:
{
+ static const char lut[] = "0123456789abcdef";
const char *t = Fl::event_text();
int i, n;
- fl_utf8decode(t, t+Fl::event_length(), &n);
+ unsigned int ucode = fl_utf8decode(t, t+Fl::event_length(), &n);
if (n==0) {
value("");
return 1;
@@ -501,10 +502,15 @@ public:
for (i=0; i<n; i++) *d++ = t[i];
*d++ = ' ';
for (i=0; i<n; i++) {
- const char lut[] = "0123456789abcdef";
*d++ = '\\'; *d++ = 'x';
*d++ = lut[(t[i]>>4)&0x0f]; *d++ = lut[t[i]&0x0f];
}
+ *d++ = ' ';
+ *d++ = '0';
+ *d++ = 'x';
+ *d++ = lut[(ucode>>20)&0x0f]; *d++ = lut[(ucode>>16)&0x0f];
+ *d++ = lut[(ucode>>12)&0x0f]; *d++ = lut[(ucode>>8)&0x0f];
+ *d++ = lut[(ucode>>4)&0x0f]; *d++ = lut[ucode&0x0f];
*d++ = 0;
value(buffer);
}