Recent

Author Topic: UTF8 filename  (Read 20814 times)

totya

  • Hero Member
  • *****
  • Posts: 720
Re: UTF8 filename
« Reply #30 on: April 22, 2015, 10:46:00 pm »
Why do you use UnicodeString? The default String is now encoded with UTF-8. UnicodeString is UTF-16 and indeed triggers a conversion at every assignment. The warning is valid.
Just use String everywhere and this problem is solved.

Thanks, but I just use string everywhere...

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: UTF8 filename
« Reply #31 on: April 22, 2015, 11:05:57 pm »
Thanks, but I just use string everywhere...

Are the warnings from a dependent package?
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

totya

  • Hero Member
  • *****
  • Posts: 720
Re: UTF8 filename
« Reply #32 on: April 23, 2015, 09:59:29 pm »
Hi!

Dependent package? What do you mean?

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: UTF8 filename
« Reply #33 on: April 24, 2015, 11:54:01 pm »
Dependent package? What do you mean?

A project can depend on packages which are also recompiled when needed.
Typical dependencies are LazUtils and LCL but you may have others.
The option -FcUTF8 for const strings does not affect units in those packages now, it should be moved to Additions and Overrides.

If the warnings come from units belonging to your project, then I have no idea what causes them.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

totya

  • Hero Member
  • *****
  • Posts: 720
Re: UTF8 filename
« Reply #34 on: April 25, 2015, 11:12:58 am »
A project can depend on packages which are also recompiled when needed. (...)

Hi!

Okay, thank you for this information (I thought similar of this).


Environment:
Fpc+lazarus is latest trunk, I comiled these about one hour ago, with fpcup.
I open my actual project (about 2000 lines).
"UTF8 in RTL" setting is ON.
Rescan fpc directories
Rebuild ide
Run/Clean up and build

Error messages only from Dependent package, see attached file. Few ansi/wide errors visible in this log.

Greetings!

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: UTF8 filename
« Reply #35 on: April 25, 2015, 12:00:48 pm »
Error messages only from Dependent package, see attached file. Few ansi/wide errors visible in this log.

Ok, can you please add -FcUTF8 to the "Additions and Overrides" in Compiler Options, as a new custom option right next to the -dEnableUTF8RTL.
Then do a clean build again.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

totya

  • Hero Member
  • *****
  • Posts: 720
Re: UTF8 filename
« Reply #36 on: April 25, 2015, 12:46:10 pm »
Error messages only from Dependent package, see attached file. Few ansi/wide errors visible in this log.

Ok, can you please add -FcUTF8 to the "Additions and Overrides" in Compiler Options, as a new custom option right next to the -dEnableUTF8RTL.
Then do a clean build again.

Hi!

After I did this, only the compile times changed in the messages.

New options, see atached file.
New compiler messages, see attached file.


JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4468
  • I like bugs.
Re: UTF8 filename
« Reply #37 on: April 25, 2015, 03:45:46 pm »
After I did this, only the compile times changed in the messages.

The UnicodeString warnings all come from RichMemo. It explicitly uses UnicodeString as I initially assumed.
For example :

C:\development\components\svn\richmemo\richmemoutils.pas(133,52) Warning: (4105) Implicit string type conversion with potential data loss from "UnicodeString" to "AnsiString"

Line 133 says :
  fs:= TFileStream.Create( UTF8Decode(FileNameUTF8), fmShareDenyNone or fmOpenRead);

You see, it calls this RTL function :
  function UTF8Decode(const s : RawByteString): UnicodeString;

The code works but it does 2 useless conversions between UTF-8 and UTF-16. If you check the other warnings carefully, they also turn out to be valid. You can ask Dmitry 'skalogryz' Boyarintsev if he wants to add support for the "better" UTF-8 system into RichMemo.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

totya

  • Hero Member
  • *****
  • Posts: 720
Re: UTF8 filename
« Reply #38 on: April 26, 2015, 08:28:22 am »
Hi!

Thanks for answers!

But as I wrote, I get many warnings from my app, and I dont't like this. I use only simple strings, and only one place where I use conversion between UTF-8 and UTF-16.
I will create sample code for you, to see this problem.

totya

  • Hero Member
  • *****
  • Posts: 720
Re: UTF8 filename
« Reply #39 on: May 04, 2015, 10:06:12 pm »
Error messages only from Dependent package, see attached file. Few ansi/wide errors visible in this log.

Ok, can you please add -FcUTF8 to the "Additions and Overrides" in Compiler Options, as a new custom option right next to the -dEnableUTF8RTL.
Then do a clean build again.

Hi!

Svn versions are terribe, so I install the latest stable version with fcpup "default" parameter. Laz: 1.4.0 /  FP: 3.0.1
Set UTF-8 in RLT button is missing, but UTF8 is working in RLT, for example Memo1.Lines.LoadfromFile('xx') xx: unicode chars (!). I didn't set any extra options for example -FcUTF8 or any... Is it normal? With old Lazarus, I get file open error with this simple project certainly.
« Last Edit: May 05, 2015, 12:17:10 pm by totya »

 

TinyPortal © 2005-2018