Recent

Author Topic: Did Lazarus will serve unicode?  (Read 9979 times)

Borneq

  • Full Member
  • ***
  • Posts: 248
Did Lazarus will serve unicode?
« on: August 03, 2010, 08:01:22 am »
From Delphi 2009 string everywhere means WideString and components calls Windows Api functions with W at end as Windows.ExtTextOutW.
Is possible this big change in FreePascal?

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1922
Re: Did Lazarus will serve unicode?
« Reply #1 on: August 03, 2010, 10:11:13 am »
Lazarus is using UTF-8 for Unicode. So you can use Unicode in Lazarus apps.

A D2009 compatible string is planned afaik, but I don't know if or when this will happen.
« Last Edit: August 03, 2010, 12:42:10 pm by theo »

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: Did Lazarus will serve unicode?
« Reply #2 on: August 03, 2010, 10:17:36 pm »
Lazarus supports unicode through UTF-8 since 2008:

http://wiki.lazarus.freepascal.org/LCL_Unicode_Support

Before Delphi implemented it.

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Did Lazarus will serve unicode?
« Reply #3 on: August 05, 2010, 02:08:04 pm »
string means AnsiString or UnicodeString?
if I have
 s:string
Length(s) count number bytes or number chars?

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1922
Re: Did Lazarus will serve unicode?
« Reply #4 on: August 05, 2010, 02:23:12 pm »
if I have
 s:string
Length(s) count number bytes or number chars?

Bytes. Use UTF8Length in LCLProc to count number of UTF-8 chars.

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Did Lazarus will serve unicode?
« Reply #5 on: August 05, 2010, 03:13:03 pm »
A D2009 compatible string is planned afaik, but I don't know if or when this will happen.
In D2009 string=WideString? If in Lazarus will string=WideString, the today utf-8 string will be for example utf8string?

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1922
Re: Did Lazarus will serve unicode?
« Reply #6 on: August 05, 2010, 03:26:09 pm »
A D2009 String is a UnicodeString which can hold "any" type, not just WideString:
http://www.drbob42.com/examines/examinA7.htm
http://www.moonsoft.fi/materials/codegear_delphi_2009_and_unicode.pdf

FPC does not have this string type currently.
« Last Edit: August 05, 2010, 03:34:21 pm by theo »

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10715
  • FPC developer.
Re: Did Lazarus will serve unicode?
« Reply #7 on: August 06, 2010, 03:21:06 pm »
A D2009 String is a UnicodeString which can hold "any" type, not just WideString:

1. the current solution of Lazarus is manual. A convention to only use UTF8. It is not enforced by the system, and the users own responsibility to insert the needed conversions

2. D2009 unicodestring is pretty much like Kylix' Widestring. Not Delphi's, which is a comtype.
   But they (unicodestring, Kylix and Delphi widestring) have in common that they are for two byte encodings.  FPC supports this in Alpha stage.

3. In D2009+ and up, ansistring was expanded to support multiple 1-byte encodings (including UTF-8). FPC does not support this yet, but a branch cpnewstr has been created for it, but development on it has stalled.

4. In D2009+ the default "string" is an unicodestring, always. In FPC this will probably depend on mode and/or OS.


After 2-4 are finished, of course all the libraries might have to be adapted to make good use of it.

Borneq

  • Full Member
  • ***
  • Posts: 248
Re: Did Lazarus will serve unicode?
« Reply #8 on: August 06, 2010, 03:33:28 pm »
3. In D2009+ and up, ansistring was expanded to support multiple 1-byte encodings (including UTF-8). FPC does not support this yet, but a branch cpnewstr has been created for it, but development on it has stalled.
In string is information about Windows It is problem with Linux code page. How solve it?

theo

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1922
Re: Did Lazarus will serve unicode?
« Reply #9 on: August 06, 2010, 05:23:02 pm »
In string is information about Windows It is problem with Linux code page. How solve it?

The problem is not with "Linux code page" which is UTF-8 (Unicode) nowadays.
Lazarus and FCL work just fine with Linux. There are problems on Windows with ANSI codepages not being Unicode.

 

TinyPortal © 2005-2018