What does your "Delphi compatible at source level" means?
I may have explained the idea inaccurately. I meant it is Delphi compatible at source level when you
use plain "String" type everywhere, and define string constants without an explicit type.
That's why I wrote:
don't use UnicodeString.
More accurately: use UnicodeString only when it is absolutely necessary. It means library APIs, in your case the fpCEF API.
Again: use UnicodeString only as a glue type for library API parameters and return values, either by typecasting or by using a variable.
Then everything works like magic and you don't need to care about encodings much.
Of course, I know below code is working correctly both the new Delphi and Lazarus 1.6, But It does not mean that Lazarus 1.6 has not the problems.
Lazarus 1.6 has no problems if you know what you are doing.
I thought to report that to Japanese users I recommend to add "{$codepage utf8}" in your source for your safe.
But I have not decided yet.
if the new compiler has {$DisableAutoStringConvert}, I decide to recommend this.;-
That can be achieved by using FPC 2.6.4, but it is not a valid choice in your case. You apparently use Unicode everywhere and the automatic dynamic encoding is a perfect match for you.
In my two projects where I use fpCEF, I use UTF8Decode. It is a relict from Lazarus 1.4. It works also in Lazarus 1.6, but it isn't needed anymore cause of the code magic of FPC 3+. I would vote for the simple typecast UnicodeString(SomeStringVar) to hide the warning.
Yes, UTF8Decode and UTF8Encode!
I use them in Lazarus 1.4 too. But I thought that I had to use UnicodeString(v) in Lazarus 1.6. Because I saw that http://wiki.lazarus.freepascal.org/Better_Unicode_Support_in_Lazarus#RTL_with_default_codepage_UTF-8 .
Probably UTF8Decode and UTF8Encode are best even now, however.
No. As Michl wrote, those explicit conversion functions are not needed any more. Besides, UTF8Decode and UTF8Encode would not work in Delphi (in case you must support it).
You seem to be confused by the whole encoding issue which is understandable. You are also a support person for Japanese users, right? Thus I recommend you to keep things simple:
1. Use UnicodeString only when necessary as a typecast or a variable.
2. Use plain "String" type everywhere else.
3. Define string constants without an explicit type.
If unsure about how a string constant is interpreted, assign it first to a "String" variable. Between variables the automatic conversion goes always right.