What about implementig a BChar class that would contain a character encoded in UTF-8? I think this would semplify the functions to get acces to the keymap. I have thinked of something like : Class BChar { ... int UTF8Char; //the Utf-8 index char PascalChars[3]; //the characters 1 to 3 in Pascal encoding int count; //how many character are encoded in the pascal string ... //members to convert from one encoding to other; }; Mattia Tristo