Recent

Author Topic: How to show spanish characters in IDE (like ñ,á,é,í,ó,ú)?  (Read 20987 times)

jluix

  • New Member
  • *
  • Posts: 19
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

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: How to show spanish characters in IDE (like ñ,á,é,í,ó,ú)
« Reply #1 on: April 16, 2007, 09:28:14 pm »
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

  • New Member
  • *
  • Posts: 30
RE: How to show spanish characters in IDE (like ñ,á,é,í,ó,ú)
« Reply #2 on: April 17, 2007, 12:28:40 am »
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

  • New Member
  • *
  • Posts: 19
RE: How to show spanish characters in IDE (like ñ,á,é,í,ó,ú)
« Reply #3 on: April 17, 2007, 06:20:32 pm »
Thanks for the answers, but...

How can I change my codepage?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: RE: How to show spanish characters in IDE (like ñ,á,é,í,
« Reply #4 on: April 18, 2007, 07:03:07 am »
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

  • Newbie
  • Posts: 2
Test this
« Reply #5 on: April 19, 2007, 06:07:42 am »
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

  • Newbie
  • Posts: 2
How to show spanish characters in IDE (like ñ,á,é,í,ó,ú)?
« Reply #6 on: April 19, 2007, 06:11:51 am »
One last thing ,

You need to have US-International Keyboard.

If you press Alt + n = ñ or Alt + i = í    etc.

skywriter

  • New Member
  • *
  • Posts: 28
Re: RE: How to show spanish characters in IDE (like ñ,á,é,í,
« Reply #7 on: May 29, 2007, 04:52:52 pm »
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

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: Re: RE: How to show spanish characters in IDE (like ñ,á,
« Reply #8 on: May 29, 2007, 05:03:37 pm »
just edit the strings that need accents with the other editor, save the file, and then load the project into lazarus.

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1933
RE: Re: RE: How to show spanish characters in IDE (like ñ,á,
« Reply #9 on: May 29, 2007, 06:59:30 pm »
There's also Edit -> Insert from Character Map to insert chars like ñ

skywriter

  • New Member
  • *
  • Posts: 28
Re: RE: Re: RE: How to show spanish characters in IDE (like
« Reply #10 on: May 30, 2007, 04:32:55 pm »
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

  • New Member
  • *
  • Posts: 28
Re: RE: Re: RE: How to show spanish characters in IDE (like
« Reply #11 on: May 31, 2007, 09:07:17 pm »
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

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: RE: Re: RE: How to show spanish characters in IDE (like
« Reply #12 on: May 31, 2007, 10:44:20 pm »
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

  • New Member
  • *
  • Posts: 28
RE: Re: RE: Re: RE: How to show spanish characters in IDE (l
« Reply #13 on: June 05, 2007, 12:21:37 pm »
"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

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: RE: Re: RE: Re: RE: How to show spanish characters in ID
« Reply #14 on: June 05, 2007, 05:48:44 pm »
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.

 

TinyPortal © 2005-2018