How to enter Unicode characters by its codes in components? lazarus / 31-LCL ---------------------------------------------------------------------- stem · 2014-07-03 11:38 Hi, in order to enter the "latin small letter n with caron" (ň), I can use the combination ALT + '+' + 0148 on my keyboard (Windows). How can I add, for example, this character to a TEdit component? The following line does not work as it shows a question mark in the component: Code: [Select]Edit.Text := #$0148; Thank you stem ---------------------------------------------------------------------- marcov · 2014-07-03 12:53 You are trying to assign an utf16 constant to a utf8 encoding property using an ascii string. So what will happen is that the constant will be converted to the current ansi encoding and then interpreted by the LCL as utf8.   On non windows the current ansi (1- byte) encoding is utf8 so there it works. On Windows not. Solution: insert an explicit conversion to utf8 Code: [Select]edit.text:=utf8encode(#$0148); ---------------------------------------------------------------------- stem · 2014-07-03 13:34 Thanx! ---------------------------------------------------------------------- Roland57 · 2014-07-03 14:54 Hello! @marcov Useful explanation and code example, but I get this error message: Code: [Select]Error: Can't determine which overloaded function to call It's Lazarus 1.2.4. ---------------------------------------------------------------------- marcov · 2014-07-03 14:58 Then try to cast the #$ expression to unicodestring or widestring. ---------------------------------------------------------------------- Roland57 · 2014-07-03 16:45 Quote from: marcov on July 03, 2014, 04:58:52 pmThen try to cast the #$ expression to unicodestring or widestring. Thank you for the answer. Code: [Select]  //Edit1.text := utf8encode(#$0148); // Error: Can't determine which overloaded function to call   //Edit1.text := utf8encode(unicodestring(#$0148)); // OK   Edit1.text := utf8encode(widestring(#$0148)); // OK ---------------------------------------------------------------------- stem · 2014-07-03 18:01 or: Code: [Select]var   x: unicodestring; begin   x := #$0148;   Edit1.Text := utf8encode(x); end;