Patches item #3160982, was opened at 2011-01-18 09:16 Message generated for change (Comment added) made by millerpuckette You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3160982...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: puredata Group: None
Status: Pending Resolution: Accepted
Priority: 5 Private: No Submitted By: IOhannes m zmlnig (zmoelnig) Assigned to: Miller Puckette (millerpuckette) Summary: [bugfix] allow to type UTF8 characters in symbolatoms
Initial Comment: since Pd-0.43 patches can handle UTF-8 characters. great!
unfortunately, it doesn't seem to work when typing in symbolboxes.
example: i switch to a russian(DOS) keyboard layout i create a message box and type the keys 'asd' which correctly shows up as 'ыфв' i create a symbolgatom and type the keys 'asd' which incorrectly show up as 'DK2'
note: sending a [symbol ыфв( to the symbolgatom, will correctly display it.
it seems like the keyboard input sanitation code for the symbolbox perverts my input.
----------------------------------------------------------------------
Comment By: Miller Puckette (millerpuckette)
Date: 2011-02-01 20:45
Message: applied to 0.43 test
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig) Date: 2011-01-19 03:04
Message: thanks.
i added your amendments to the attached patch
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2011-01-19 02:51
Message: ... of course that was meant to be:
- char utf8[4]; + char utf8[UTF8_MAXBYTES];
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody) Date: 2011-01-19 02:51
Message: argh... beat me to it! :-)
anyhoo, you might want to also:
+ #include "s_utf8.h" ... - char utf8[4]; - char utf8[UTF8_MAXBYTES];
so that things don't break if we need the full UCS-4 range someday. Sorry; I would have attached a patch (now that I've managed to acquire a rudimentary working knowledge of git :-), but I don't seem to be able to (looks like an instance of http://sourceforge.net/apps/trac/sourceforge/ticket/16001)
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig) Date: 2011-01-19 02:11
Message: mukau, i'm IOhannes not hans :-) i'm working on pd-vanilla: http://pure-data.git.sourceforge.net/git/gitweb.cgi?p=pure-data/pure-data;a=...
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig) Date: 2011-01-19 02:09
Message: anyhow, i have a fix for the problem. instead of writing the wchar into a char, the wchar is first decoded to utf8 using u8_wc_toutf8() and only then written into the symbol-buffer of the atom.
this seems to work fine.
the attached patch modifies g_text.c and applies to f5cabb ("took out debug msg")
----------------------------------------------------------------------
Comment By: Bryan Jurish (mukau) Date: 2011-01-19 02:08
Message: ok; trying to look into this now; have you any idea what sources you built from? I'm currently using most recent snapshot from http://pure-data.git.sourceforge.net/git/gitweb.cgi?p=pure-data/pd-extended.... ; ... svn doesn't appear to have the utf-8 patches applied anywhere yet...
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig) Date: 2011-01-19 02:01
Message: @mukau: no, LC_* are not changed at all (btw, they are set to de_AT.UTF-8 here) the kbd layout changes only effect the key->character mapping, way before tk is involved. also note, that tk can handle all quite well, as can most parts of Pd (confirm: i can type cyrillic characters in objects, msgboxes and comments)
it's only gatom's that do some additional magic to filter out unwanted characters, and then write the received wchar into a char without checking.
----------------------------------------------------------------------
Comment By: Bryan Jurish (mukau) Date: 2011-01-18 12:45
Message: What exactly does "changing the keyboard layout" entail? Does it e.g. change your locale (LC_ALL, LC_CTYPE, etc.)? That might annoy Tk's unicode handling...
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig) Date: 2011-01-18 09:31
Message: one more thing: in the original report i said that typing 'asd' should result in 'ыфв' which is wrong. it should rseult in ''фыв' ('a'='ф', 's'='ы', 'd'='в')
----------------------------------------------------------------------
Comment By: IOhannes m zmlnig (zmoelnig) Date: 2011-01-18 09:30
Message: btw, in normal (de) kbd-layout, when i type (and releae) 'a', pd-gui sends: .x99e9708 key 1 97 0; .x99e9708 key 0 97 0;
whereas when i switch to russian, pd-gui sends (again key 'a'): .x99e9708 key 1 1092 0; .x99e9708 key 0 a 0;
"1092" is the unicode number for "ф" (which is what should show up, when i press 'a') i don't know why the keyup sends 'a' instead.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478072&aid=3160982...