Marcos Douglas B. Santos wrote:
> I am develop on Windows. What problems do you mean?

Unicode is recommended also on Windows. No worries. You don't need to
use the old system codepages.
People who need them must convert them explicitly because the Unicode
system of Lazarus does not support them directly.

> Sorry about that. I stopped using Delphi at version 7, that uses ANSI.
> I thought that Delphi nowadays was using UTF16.
> I will install Delphi Tokyo Starter and discover these things.

You confuse separate things now.
The encoding of their "String" is now UTF-16.
Source files are saved as UTF-8.

> But if I put theses constants as resourcestrings, it's Ok as Mattias
> told me, right?

I don't think it makes any difference. You can use the full Unicode in
both cases.

---
I am puzzled why there were so many misleading and confusing replies,
also from knowledgeable Lazarus developers.
Remember, the question was about making sources compatible with Delphi.
The person (Marcos Douglas) did not know details of how strings work
in Delphi and Lazarus.
Now we finally have a system that allows (more or less) compatible
code when using Unicode. Why was it not even mentioned by you guys?

For example:

Ondrej Pokorny wrote:
> Speaking from my experience, the only approach (not only the best one but
> the only one) is not to use characters above #255.

Nonsense. Full Unicode is supported.

Mattias Gaertner wrote:
> Option a) You can use English in sources and load all non ASCII
> constants via resourcestrings or similar. Then the codepage is
> irrelevant.
> Option b) You can store all files as UTF-8 with BOM. Then FPC will
> store all non ASCII string constants as unicodestrings. Be careful when
> using PChar with them. This adds implicit conversions, so it might be
> slower.

That must be very confusing. Why didn't you just tell him to use the
default Unicode support in Lazarus which allows to write Delphi
compatible code, just by remembering couple of rules.

Also Tony's advice to use AnsiString explicitly is quite irresponsible
for a person who looks for Delphi compatibility.
AnsiString is not Delphi compatible any more in our system and it
brings you back to stone-age in Delphi, to the horrors of system
codepages.

Is it possible that people still don't know how Delphi compatible the
Lazarus Unicode system is (unless you need the old system codepages
obviously)?
For example Lazarus developer Werner (wp) didn't know the Ansi...()
string functions, like AnsiCompareStr(), are compatible with Delphi.
 
http://forum.lazarus.freepascal.org/index.php/topic,36664.msg244619.html#msg244619
Yes they are!

Please also look at program LazUnicodeTest in components/lazutils/test/.
It does advanced Unicode stuff and works in both Delphi and Lazarus.
It means any code dealing with Unicode can do it.

How could this thing be communicated so that people understand?
Why other Lazarus developers don't want to mention it?
I am puzzled. :(

Juha
-- 
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
http://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to