How to show spanish characters in IDE (like ñ,á,é,í,ó,ú)? lazarus / 1-Linux ---------------------------------------------------------------------- jluix · 2007-04-16 19:16 Hi! I've working with Lazarus under windows the last 2 years. I think is a fantastic RAD tool. Now, I'm moving all my work to linux (Ubuntu) and, among other problems, I can't use spanish characters into the IDE (in windows I haven't got any problem), like ñ, á, é, í, ó, ú. Well, the real behaviour of Lazarus is to substitute that characters by '?'. I read in other link a similar trouble for Danish characters, but I don't know how translate to my own situation. Could you help me? ---------------------------------------------------------------------- felipemdc · 2007-04-16 19:28 Using character with accents on the object inspector should work if your IDE is compiled for Gtk 2, or your system´s gtk 1 is configured for utf-8 However it´s a know limitation that the code editor doesn´t support this kinds of characters. Possible solutions are: * Write the code with another editor * Write a few characters with another editor and then use CTRL+C / CTRL+V to copy them around with the lazarus editor * Submit a patch to introduce this feature * Create a bounty to pay someone else to write this feature ---------------------------------------------------------------------- Wanagen · 2007-04-16 22:28 Try to change your codepage to : ISO-8859-1 - latin1 or Windows - cp1252 (Latin I) because utf-8 don't provide all euro-occidental char ---------------------------------------------------------------------- jluix · 2007-04-17 16:20 Thanks for the answers, but... How can I change my codepage? ---------------------------------------------------------------------- felipemdc · 2007-04-18 05:03 Quote from: "Wanagen"because utf-8 don't provide all euro-occidental char That´s very far from the truth. utf-8 does provide all ocidental characters, plus all orientals, plus a lot more. In fact it provides all characters one could ever need =) ---------------------------------------------------------------------- juanki23 · 2007-04-19 04:07 I test this method with the last stable version of lazarus. 1. Open Lazarus 2. Goto Lazarus Source editor 3. Right Click and go to editor properties 4. Goto to Display 5. Check  Default editor font Put this an example -adobe-courier-medium-r-normal-*-*-100-*-*-m-*-iso10646-1 Goto to source editor a check if áéíóúñ work. Also you can change the font pressing the ... button. this work for me. The only thing that don't work is this character    " '  " . The single quote don't work. If anybody know to solve this problem please reply or make a post. Thank you. ---------------------------------------------------------------------- juanki23 · 2007-04-19 04:11 One last thing , You need to have US-International Keyboard. If you press Alt + n = ñ or Alt + i = í    etc. ---------------------------------------------------------------------- skywriter · 2007-05-29 14:52 Quote from: "sekel" * Write the code with another editor How can i use another code editor with lazarus and force this another editor to compile and step-by-step debug code? ---------------------------------------------------------------------- felipemdc · 2007-05-29 15:03 just edit the strings that need accents with the other editor, save the file, and then load the project into lazarus. ---------------------------------------------------------------------- theo · 2007-05-29 16:59 There's also Edit -> Insert from Character Map to insert chars like ñ ---------------------------------------------------------------------- skywriter · 2007-05-30 14:32 Quote from: "sekel"just edit the strings that need accents with the other editor, save the file, and then load the project into lazarus. Well, it seems i asked was wrong question. The problem is that i cannot write or read any russian letters neither in code editor nor in Object Inspector. I use Mandriva 2007 with default locale ru_RU.UTF8. Instead of one russian symbol i type from keyboard there are two non- readable symbols appears in code. After reading about bad support of UTF8 by GTK  i tried to change from konsole values of variables 'LANG=ru_RU.KOI8-R' and 'LC_ALL=ru_RU.KOI8-R' but when i launch lazarus it writes me that 'Xlib' cannot find locale 'ru_RU.KOI8-R'! Then i changed values of variables to LANG=ru_RU and LC_ALL=ru_RU. I don't know what exactly mean locale "ru_RU" (i was shure this is the same as ru_RU.KOI8-R!) and after this change it has become possible to write correct russian symbols in Object Inspector but not in code editor! I tried to change code editor's font, but symbols were still unredable. But when i manually specify INCORRECT font option for code editor they become readable! It seems, the "default" font is suitable for russian tables, but it has unchangable small size which is hard to read. Please help me find out how to make possible to change font in code editor and prefferably in main menu too? ---------------------------------------------------------------------- skywriter · 2007-05-31 19:07 Well, does anybody just know from where lazarus takes fonts for it's menus and how it possible to force it to use my own font for menus? ---------------------------------------------------------------------- felipemdc · 2007-05-31 20:44 Changing the font for the code editor will probably be a bad thing to do. The code editor simply isn't currently prepared to handle utf-8, and forcing it to use another encoding will cause trouble when you distribute your app to other people, because they will most likely be using utf-8 on their system. My recomendation: Revert your system to use utf-8 Then don't use the object inspector or the code editor to write characters with accents (actually the object inspector should work perfectly, or at least it does to me, but well ...). Write code to associate strings with the objects. For example, create a OnCreate event handler for your form and add code like this:   MyCaption.Caption := '';   MyMemo.Strings.Text := '';   MyComboBox.Items.Add('');  etc Then use another text editor (like gedit or kedit) to add the strings you need on your code. After you do that you can open your project again on lazarus and keep working with it. The characters will look wrong, but that's no problem. One special character will appear as 2 wierd characters, but that's normal. That's because UTF-8 uses 1 or more bytes for each character. For ascii characters it uses the same 1 byte as in iso With accents it will likely use 2 bytes You can copy+paste the 2 characters that form a special character around using the code editor and at run time they will show normally. ---------------------------------------------------------------------- skywriter · 2007-06-05 10:21 "The characters will look wrong" is probalbly a problem, because we like to write a lot of comments in source code on our native language to simplify understanding. I found this desicion: launch Lazarus and application written on it from script which temporary changes locale to ru_RU.CP1251. Simultaneously this solves problem of converting code written on Delphi. Unfortunely only locale iso8859-5 ensures correct visibility of fonts. For locale cp1251 i was induced to manually edit file /etc/gtk/gtkrc.cp1251 to specify correct font's settings but it seems this is trouble of my distro. Now (with locale cp1251) i can see correct Delphi-written code with comments in code editor, correct russian symbols in text fields of controls such as button's captions and in values of text fields in object's inspector. But not in caption's of forms! If i add any russian symbols to caption of form the whole caption momentally disappear. This occurs as during runtime as during edit time. It seems Lazarus takes font settings for caption not from /etc/gtk. Does it? ---------------------------------------------------------------------- felipemdc · 2007-06-05 15:48 Quote from: "skywriter""The characters will look wrong" is probalbly a problem, because we like to write a lot of comments in source code on our native language to simplify understanding. This is the real problem that needs a fix on Lazarus. The other problems only occur because you are trying to work around this one. I would like to encourage people that need this feature to either: * Submit a patch implementing it or * Post a bounty for it here: http://wiki.lazarus.freepascal.org/Bounties SynEdit (the control that makes the code editor work) needs to be fixed so it can properly show and write UTF-8 characters. ---------------------------------------------------------------------- theo · 2007-06-05 17:02 There is a Unicode enabled Synedit. http://mh-nexus.de/unisynedit.htm Porting this to LCL would probably solve many issues. But it's a lot of work. ---------------------------------------------------------------------- skywriter · 2007-06-06 08:01 sekel, theo: As i say above problem with symbols persists also in object inspector and in caption's of forms. Will be enough to fix or replace only synedit? ---------------------------------------------------------------------- skywriter · 2007-06-06 08:36 sekel: Well, you didn't ask my question. I said above i don't need UTF8 support because i solved the problem by changing my locale. Consequently i don't see reason to make any efforts for UTF8 support. And i just said that there is no problems with locale iso8859-5, but there are still ones with cp1251 with font in form's caption. The question is: where Lazarus gets info about font it use in captions of form? Learning Lazarus source code  will take from me so much time that it will make me impossible to solve my current tasks. And if i can't solve my tasks Lazarus becomes useless for me and for my colleagues. We will prefer to spend this time moving to KDevelop for example. ---------------------------------------------------------------------- felipemdc · 2007-06-06 09:04 Quote from: "skywriter"sekel, theo: As i say above problem with symbols persists also in object inspector and in caption's of forms. Will be enough to fix or replace only synedit? Sorry, I can't reproduce. I am using Lazarus gtk 1 IDE on Mandriva Linux, locale configure to UTF-8, and *everything*, except SynEdit works perfectly with accented characters. http://wiki.lazarus.freepascal.org/Image:Lazarus_gtk1_unicode.png See the object inspector, the form while designing, the form while running, the form caption. Everything is perfect. I tested with a old revision and then I did a svn update and then rebuild my entire lazarus. In both cases it worked perfectly. If utf-8 locale doesn't work for you, I would suggest checking the following things: * Your lazarus version, maybe it's old * Your distribution. Maybe it's old and doesn't give proper Gtk 1 UTF-8 support. Here is my Lang enviroment variable: [felipe@felipe lazarus]$ echo $LANG de_DE.UTF-8 ---------------------------------------------------------------------- felipemdc · 2007-06-06 09:18 Quote from: "skywriter"sekel: Well, you didn't ask my question. I said above i don't need UTF8 support because i solved the problem by changing my locale. Consequently i don't see reason to make any efforts for UTF8 support. I won't say you can't solve your problems this way, but I think you will face problems on the future by doing this. It is one thing to get your app running on your machine. To get it running on any Linux machine is something completely different. I have a medium cross-platform project working with accented characters (it has translations to several languages) on both win32 and gtk2. it's gpl, so you can download the sources and see how I made it work across all target machines here: http://magnifier.sourceforge.net/ All distributions that I know about are removing non-utf-8 encodings support, so your application may have trouble running on new distributions. Further, Gtk 1 itself is already old, you will need to convert to Gtk 2 on the future. I actually use Gtk 2 for most of my projects. And Gtk 2 *only* support UTF-8 QuoteThe question is: where Lazarus gets info about font it use in captions of form? Afaik it doesn't get it from anywhere. It just passes the string you provided to Gtk without any modifications. Gtk handles it as he likes, or better: as he is configured to. QuoteWe will prefer to spend this time moving to KDevelop for example. Unless you only write GPL software, a Qt license costs 1000 euros per developer per platforms. Further, try reading their license. It's absurdely restrictive. Also, KDevelop only works on Linux, and if you use any KDE components your app will also only work on Linux. Lazarus runs on Windows, Macintosh, all Unixes, cross-compiles to Windows CE, etc. It is actually much cheaper to pay someone to implement utf-8 support on SynEdit. ---------------------------------------------------------------------- skywriter · 2007-06-07 04:50 sekel: Thanx for answer. I will think about GTK2 and licensing also...