Recent

Author Topic: Unicode  (Read 7116 times)

jsantos98ow,

  • Guest
Unicode
« on: April 05, 2006, 10:41:17 pm »
Hello All,

First of all, my congrats on this project. It amazed me!

Now, my question... As far as I could test, the LCL is not unicode in Win32 right? I mean, it is not possible to have, for example two edit boxes each with a different character set (Japanese in one and Chinese in another, p.e.). This is possible using the TNT components in Delphi.

What I've seen in other questions similar in this forum, is that the LCL is UTF-8 compatible. This is not enough for me.

If my first assumption is correct, can anyone tell me if will this ever be available (if it is planned)?


Thanks in advance.

Joao Santos

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Unicode
« Reply #1 on: April 05, 2006, 11:39:57 pm »
Quote from: "jsantos98ow,"
What I've seen in other questions similar in this forum, is that the LCL is UTF-8 compatible. This is not enough for me.


Why not? UTF-8 has exactly the same symbols as utf-16.

Anonymous

  • Guest
RE: Re: Unicode
« Reply #2 on: April 06, 2006, 10:20:58 am »
hello,

Because you cannot place there something like "Thai: ฉันกินกระจกได้ แต่มันไม่ทำให้ฉันเจ็บ". At least, I wasn't able to, although I tried to set the charset to Unicode and use a unicode capable font.

If I'm wrong, please correct me.


Regards,

Joao

CCRDude

  • Hero Member
  • *****
  • Posts: 615
RE: Re: Unicode
« Reply #3 on: April 07, 2006, 09:18:04 am »
Hmmm actually he seems right. I tried with a TEdit and charset set to Unicode, but couldn't paste that text, neither in design- nor runtime.

I then went and tried to directly assign UTF-8 to a TEdit. Since the Lazarus IDE is not yet Unicode it seems (pasting foreign text like the above or below in original form simply replaces everything with a lot of question marks).

Edit1.Text := #50#48#48#32#208#191#208#190#32;
// three arabic numbers and then two russian letters, from an album title I didn't pick
// because I like it, but because I knew the mix latin/russian charset.

Neither with Edit1.Font.Charset = DEFAULT_CHARSET nor UNICODE, this would show the correct text.

I'm using 0.9.14.1 currently.

Anonymous

  • Guest
RE: Re: Unicode
« Reply #4 on: April 07, 2006, 04:55:06 pm »
CCRDude,

Was this working on previous versions? I only tried in 0.9.14 Beta.

Regards,

Joao Santos

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
RE: Re: Unicode
« Reply #5 on: April 07, 2006, 10:52:12 pm »
Ummm .... this needs to be investigated.

I'm pretty sure utf-8 strings work on TEdit for Gtk2 software produced with Lazarus.

I wonder what is the problem on Windows. Maybe calls to Ansi version of WinAPi function should be changed to the Wide version. Then we would need to do conversion from utf-8 to utf-16 to use the Unicode set of WinAPI calls

Anonymous

  • Guest
RE: Re: Unicode
« Reply #6 on: April 07, 2006, 11:41:36 pm »
Sekel,

If I may, I would suggest to use the same approach used in the TNT components for delphi. Something like

if (OperatingSystemIsUnicode) then
   CreateWindowW (...)
else
   CreateWindowA (...)

With this both Windows 9x, Me and NT,2000,XP,2003 would work with the same components.

I didn't have time to see how this was implemented in Lazarus, but, if it is already like this, sorry...  :oops:

Regards,

Joao

 

TinyPortal © 2005-2018