Euro sign lazarus / 9-Editor ---------------------------------------------------------------------- cyclo · 2007-08-20 15:27 Hi, When using the euro sign, it is shown as a wrong sign in the IDE, and I cannot find it in the character table either. Nevertheless, if I read the .pas file with writer, it is there. The problem is that it is not shown correctly when running the application: the wrong sign replaces it. Does any one know about how to use the correct character set ? I am using Lazarus on Linux MDV 2007 Thanks for any help ---------------------------------------------------------------------- LazaruX · 2007-08-21 07:09 HI, yeah, I also discovered that. A month ago (maybe more) I started a program, and it compiled correctly with the Euro signi. Now it i compile the program it also shows a strange symbol. Since last time I reinstalled lazarus! Maybe this is the problem. ---------------------------------------------------------------------- cyclo · 2007-08-22 22:11 The funny thing is that when I decided to use an E instead of the symbol, and for that select ed the symbol and choose Edit/Replace, in the replace window I got the right sign. So, this sign is only not appearing in the editor, and unfortunatly in the compiled program. I also tried to change the character set of the forms in the object inspector, but no success selecting DEFAULT, ANSI or UNICODE ---------------------------------------------------------------------- felipemdc · 2007-08-23 09:20 Which widgetset are you using? Gtk 1? Gtk 1 has internationalization problems. If you write your euro simbol encoded on utf-8, and the system is iso, it won't show ok. I recomend that you recompile your application for gtk-2 and make sure all your strings are utf-8 encoded on the source file. Use an external editor, like kate or gedit to be sure of that. And make sure your file doesn't have a BOM Marker, because of a fpc limitation this marker will cause trouble. Many text editors have 2 save options: save as utf-8 and save as utf-8 without BOM. Choose the one without a BOM ---------------------------------------------------------------------- cyclo · 2007-08-23 13:56 Yes I was using GTK1 So, I installed the devel package for GTK2, and compile the LCL, but when compiling my application, it just closes after one second. The executable is created, and I can launch it from outside the IDE, but with the same result. So, I still have to investigate for the reason of that behavior Any idea ? Thanks ---------------------------------------------------------------------- LazaruX · 2007-08-23 15:33 Hi Sekel, I had the problem using Windows, so its not GTK problem I think. PS WinXP ---------------------------------------------------------------------- felipemdc · 2007-08-23 19:04 The windows problem is probably unrelated to the gtk one. For Windows I would try to use the unicode lcl and see how it goes: http://wiki.lazarus.freepascal.org/LCL_Unicode_Support#Unicode- enabling_the_win32_interface It's still under development, but testing is always appreciated =) ---------------------------------------------------------------------- cyclo · 2007-08-23 22:09 Well, I made just a small test. Even compiled for GTK2, a label with a caption containing the euro sign is correctly displayed in the object inspector, but it is not correct on the form, nor at run time. In the charcter table, the sign is not correctly displayed too. But with GTK2, even other accentuated charcters are not displayed, and replaced by a "" at run time All these characters are correct when reading the .pas file with Kate So, I am back to GTK1 for the moment, and will probably use an E instead of the euro sign Thanks anyway ---------------------------------------------------------------------- felipemdc · 2007-08-24 06:25 This is probably because you are using your system configured to ISO encoding, and not UTF-8. Gtk 2 requieres the use of utf-8, so if you are using a gtk-1 compiled IDE, which uses just whatever the system uses, to edit a gtk2 project, this will lead to the problem you described. One of the following solutions would work: 1 - Reconfigure your system to use utf-8 or 2 - When using an external editor, like kate, make sure you are saving the file as utf-8 without bom marker. It get's easier to control this if you set the captions at run-time, so you only need to edit the source file with an external editor. or 3 - Build your Lazarus IDE with Gtk 2 ---------------------------------------------------------------------- felipemdc · 2007-08-24 06:31 Quote from: "cyclo"All these characters are correct when reading the .pas file with Kate It doesn't matter if they "read ok". They need to be on the correct encoding, which is utf-8 for gtk2. More information here: http://wiki.lazarus.freepascal.org/LCL_Unicode_Support ---------------------------------------------------------------------- felipemdc · 2007-08-24 06:48 All of this unicode talk is because I think that the euro sign can only be represented on unicode and not with standard ISO 8859-1, which gtk1 is probably using on your system. http://en.wikipedia.org/wiki/ISO/IEC_8859-1 According to wikipedia the iso 8859-15 can represent the euro sign. But if you need to do an encoding change, it's better to go to unicode directly, which can represent almost anything, and will be the default on the future anyway. ---------------------------------------------------------------------- Vincent Snijders · 2007-08-24 06:58 Quote from: "cyclo" But with GTK2, even other accentuated charcters are not displayed, and replaced by a "" at run time If it works in the IDE, but not at run-time and you are using *nix, then add cwstring (the widestring manager used for unicode conversion) to your uses clause. ---------------------------------------------------------------------- cyclo · 2007-08-24 09:58 Ok, thank you for your help guys In fact, my system is using UTF8 by default, with an option to keep compatibility with non-UFT8 encoding After re-building LCL, IDE and SynEdit, I finally got the correct result either for the euro sign and the accentuated characters Unfortunatly, it seems that using GTK2 can lead me to other small problems due to differences in implementation level with gtk1 ---------------------------------------------------------------------- felipemdc · 2007-08-24 19:35 Yes, but gtk 2 is more advanced as a widgetset, and is better supported by linux distributions, so it's a favorable choice moving from gtk1 to it. Lazarus itself will also move from gtk1 to gtk2 as default widgetset in the future. ---------------------------------------------------------------------- cyclo · 2007-08-25 08:27 I understand the point, of course, but for now, it is some work to get working applications run with gtk2 as they do with gtk1. So, I managed to get two copies of Lazarus, one compiled for gtk1, and the other for gtk2 (it seems ok   ), and (slowliy) I intend to move from 1 to 2 (I have no professional constraints) Many thanks Sekel ---------------------------------------------------------------------- theo · 2007-08-25 09:46 It's a bit sad, that most of the bugreports for GTK2 are targetted for 1.2. So you can't say it's supported to the same level as GTK1 or Win32. I'd prefer GTK2 on Linux for the look, the antialiased fonts and unicode. ---------------------------------------------------------------------- Vincent Snijders · 2007-08-25 21:17 It is a bit sad, that there are so little lazarus developers, that they decided to focus their efforts on the two most stable widget set interfaces available in the LCL. That way Lazarus 1.0 can be released sooner. Fortunately, there is an escape for people wanting gtk2 in Lazarus 1.0: Provide patches with bug fixes for the gtk2 interface. If lazarus - gtk2 works as good as gtk1, Lazarus 1.0 will shop with gtk2 as default.