37,40c37,52
< static char *letters_array[LETTERS_ARRAY_LENGTH] = {
<   "0123456789",
<   G_CSET_A_2_Z,
<   G_CSET_a_2_z
---
> static char *letters_array[6] = {
> "あえいおうかけきAÁBCČDE123456こくまめみもむ",
> "あえいおうかけきAÁBCČDEÉFGHIÍJKLMNOÓPQRŘSŠTUÚVWXYÝZŽこくまめみもむ",
> "あえいおうかけきAÁBCČDEÉFGHIÍJKLMNOÓPQRŘSŠTUÚVWXYÝZŽこくまめみもむ",
> "あえいおうかけきAÁBCČDEÉFGHIÍJKLMNOÓPQRŘSŠTUÚVWXYÝZŽこくまめみもむ",
> "あえいおうかけきAÁBCČDEÉFGHIÍJKLMNOÓPQRŘSŠTUÚVWXYÝZŽこくまめみもむ",
> "あえいおうかけきAÁBCČDEÉFGHIÍJKLMNOÓPQRŘSŠTUÚVWXYÝZŽこくまめみもむ"
> };
> 
> #define KEYMAP_SIZE 5
> static char *keymap[KEYMAP_SIZE] = {
> "3あ",
> "4う",
> "5え",
> "6お",
> "3こ"
202c214,216
<   char str[2];
---
>   char lcStr[6],ucStr[6], *str;
>   char utf8char[6];
>   int i;
203a218
>   printf("in key_press");
269,285c284,290
<   c = tolower(keyval); 
<   str[0] = c;
<   str[1] = '\0';
<   if (g_hash_table_lookup_extended (letters_table,
< 				    (char *)&str,
< 				    (gpointer) &old_name,
< 				    (gpointer) &old_value))
<     {
< 
<       player_win(item_find_by_title((char *)&str));
< 
<     }
<   else
<     {
<       gchar *list_of_letters[255];
< 
<       list_of_letters[0] = '\0';
---
> /* first check the obvious - simple keystrokes 
>    check for keymap 
>    convert to unichar/utf8
>    set to lower case
>    check direct match
>    check upper case match
>  */
287,290c292,293
<       /* We have to loop to concat the letters */
<       g_hash_table_foreach (letters_table,
< 			    (GHFunc) add_char,
< 			    list_of_letters);
---
>   for(i = 0; i < KEYMAP_SIZE; ++i)
>      if (keyval == keymap[i][0]) {
292,293c295,348
<       /* Log what happened, what was expected, what we got */
<       gcompris_log_set_comment(gcomprisBoard, list_of_letters, str);
---
>         /* match in keymap */
>         sprintf(utf8char, "%s", keymap[i]+1);
>         printf("utf8char: %s\n",utf8char);
>         if (g_hash_table_lookup_extended (letters_table,
>                                         (char *)&utf8char,
>                                         (gpointer) &old_name,
>                                         (gpointer) &old_value))
>             {
>               printf("looking for %s\n",utf8char);
>               player_win(item_find_by_title((char *)&utf8char));
>               str = lcStr;
>               return TRUE;
>             }
>         }
> 
>     sprintf(utf8char, "%c", gdk_keyval_to_unicode(keyval));
>     g_unichar_to_utf8 (gdk_keyval_to_unicode(keyval),
> 		     utf8char);
> 
>     sprintf(lcStr,"%s",g_utf8_strdown(utf8char,-1));
>     sprintf(ucStr,"%s",g_utf8_strup(utf8char,-1));
> 
>     printf("checking...lc: %s, uc: %s\n",lcStr,ucStr);
>       /* no match in keymap */
>     if (g_hash_table_lookup_extended (letters_table,
>                                         (char *)&lcStr,
>                                         (gpointer) &old_name,
>                                         (gpointer) &old_value))
>             {
>               printf("found %c\n",lcStr[0]);
>               player_win(item_find_by_title((char *)&lcStr));
>               str = lcStr;
>               return TRUE;
>             }
> 
>      printf("checking uc...");
>      if (g_hash_table_lookup_extended (letters_table,
>                                       (char *)&ucStr,
>                                       (gpointer) &old_name,
>                                       (gpointer) &old_value))
>       {
>          printf("found %c\n",ucStr[0]);
>          player_win(item_find_by_title((char *)&ucStr));
>          str = ucStr;
>          return TRUE;
>          }
> 
>      gchar *list_of_letters[255];
>      list_of_letters[0] = '\0';
> 
>      /* We have to loop to concat the letters */
>      g_hash_table_foreach (letters_table,
>          (GHFunc) add_char,
>          list_of_letters);
295,296c350,354
<       player_loose();
<     }
---
>            /* Log what happened, what was expected, what we got */
> /*
>            gcompris_log_set_comment(gcomprisBoard, list_of_letters, str);
> */
>      player_loose();
428c486
<   int i;
---
>   int i,j,k;
430c488
<   char *lettersItem;
---
>   char *lettersItem, *str_p;
437c495
<   lettersItem = g_malloc (2);
---
>   lettersItem = g_malloc (6);
443a502
>   k=g_utf8_strlen(letters_array[0],-1);
445,451c504,505
<     i=rand()%strlen(letters_array[gcomprisBoard->level%LETTERS_ARRAY_LENGTH]);
<     sprintf(lettersItem, "%c",
< 	    letters_array[gcomprisBoard->level%LETTERS_ARRAY_LENGTH][i]);
< 
<     /* Changing the letter to lower case : should be easier but these works */
<     c = tolower(lettersItem[0]); 
<     sprintf(lettersItem, "%c", c);
---
>     str_p=letters_array[0];
>     i=rand()%k;
453c507,515
<   } while(item_find_by_title(lettersItem)!=NULL);
---
>     printf("str len: %d, char pos: %d\n",k,i);
> 
>     for( j = 0; j < i; j++) {
>         str_p=g_utf8_find_next_char(str_p,NULL);
>         printf("str p: %x\n",str_p);
>        }
>     sprintf(lettersItem, "%lc",
> 	    g_utf8_get_char(str_p));
>     printf(lettersItem);
455c517
<   lettersItem[1] = '\0';
---
>   } while(item_find_by_title(lettersItem)!=NULL);
464d525
< 
