Recent

Author Topic: Unicode resourcestring  (Read 2319 times)

zamtmn

  • Hero Member
  • *****
  • Posts: 622
Unicode resourcestring
« on: February 02, 2023, 07:42:38 am »
Is it possible in the future to split resource strings into utf8 and utf16? of course, everything is working now, but we have to fight with warnings
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. resourcestring
  3.   rstest='blbla-blbla';
  4. var
  5.   vtest:unicodestring;
  6. begin
  7.   vtest:=rstest;
  8. end.
>>project1.lpr(7,10) Warning: Implicit string type conversion from "AnsiString" to "UnicodeString"

PascalDragon

  • Hero Member
  • *****
  • Posts: 5678
  • Compiler Developer
Re: Unicode resourcestring
« Reply #1 on: February 02, 2023, 09:22:24 pm »
We are currently working on a UnicodeString based RTL. In that RTL (but not the Ansi-RTL) resource strings will be UnicodeString, otherwise they won't.

zamtmn

  • Hero Member
  • *****
  • Posts: 622
Re: Unicode resourcestring
« Reply #2 on: February 02, 2023, 09:29:42 pm »
that is, for something like this:
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. resourcestring
  3.   rstest='blbla-blbla';
  4.   rstest1:unicodestring='blbla-blbla';
  5.   rstest2:ansistring='blbla-blbla';
  6. begin
  7. end.
there is no hope((

jcmontherock

  • Sr. Member
  • ****
  • Posts: 263
Re: Unicode resourcestring
« Reply #3 on: February 02, 2023, 09:54:34 pm »
@PascalDragon:

Which UnicodeString ? UTF-8 or UTF-16 ?
Windows 11 UTF8-64 - Lazarus 3.4-64 - FPC 3.2.2

PascalDragon

  • Hero Member
  • *****
  • Posts: 5678
  • Compiler Developer
Re: Unicode resourcestring
« Reply #4 on: February 03, 2023, 03:55:37 pm »
that is, for something like this:
Code: Pascal  [Select][+][-]
  1. program Project1;
  2. resourcestring
  3.   rstest='blbla-blbla';
  4.   rstest1:unicodestring='blbla-blbla';
  5.   rstest2:ansistring='blbla-blbla';
  6. begin
  7. end.
there is no hope((

Correct.

@PascalDragon:

Which UnicodeString ? UTF-8 or UTF-16 ?

When I said UnicodeString I meant UnicodeString. With that information you should know which encoding is used.

jcmontherock

  • Sr. Member
  • ****
  • Posts: 263
Re: Unicode resourcestring
« Reply #5 on: February 03, 2023, 05:36:02 pm »
Unicode string means generally UTF-16. UTF-16 could be Le or Be.
Some people speaks, wrong, Unicode string for UTF-8. Please, use the exact denomination...  ;D ;D
Windows 11 UTF8-64 - Lazarus 3.4-64 - FPC 3.2.2

Thaddy

  • Hero Member
  • *****
  • Posts: 15706
  • Censorship about opinions does not belong here.
Re: Unicode resourcestring
« Reply #6 on: February 03, 2023, 05:45:49 pm »
Unicode string means generally UTF-16. UTF-16 could be Le or Be.
Some people speaks, wrong, Unicode string for UTF-8. Please, use the exact denomination...  ;D ;D
It is the other way around. MS uses unicode 16 (based on UCS) and the rest of the world uses UTF8.
FPC/Lazarus is not MS centric. Personal opinion is that I really dislike UTF8, but I have to use it, because I do server platforms and most of those are unix derived..
If I smell bad code it usually is bad code and that includes my own code.

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Unicode resourcestring
« Reply #7 on: February 03, 2023, 06:33:23 pm »
Unicode string means generally UTF-16. UTF-16 could be Le or Be.
Some people speaks, wrong, Unicode string for UTF-8. Please, use the exact denomination...  ;D ;D
:o
It is the other way around. MS uses unicode 16 (based on UCS) and the rest of the world uses UTF8.
FPC/Lazarus is not MS centric. Personal opinion is that I really dislike UTF8, but I have to use it, because I do server platforms and most of those are unix derived..
:o :o

...you both crush my world with your sentences...
UTF8 / UTF16 is both just a different bitness as an encoding format used by Unicode.
Unicode is Unicode, nothing more nothing less.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Unicode resourcestring
« Reply #8 on: February 03, 2023, 06:40:45 pm »

...you both crush my world with your sentences...
UTF8 / UTF16 is both just a different bitness as an encoding format used by Unicode.
Unicode is Unicode, nothing more nothing less.

Hi!

Ans why are Windows strings when I read them with Linux are wrong encoded?

Winni

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Unicode resourcestring
« Reply #9 on: February 03, 2023, 06:47:35 pm »
Windows strings
As soon as I know the definition of "Windows strings" and how you decode I can answer that.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Unicode resourcestring
« Reply #10 on: February 03, 2023, 07:28:20 pm »
Windows strings
As soon as I know the definition of "Windows strings" and how you decode I can answer that.

UTF 16

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Unicode resourcestring
« Reply #11 on: February 03, 2023, 07:54:41 pm »
In unit LazUTF8 are some generic methods to deal with UTF16, like ConvertUTF16ToUTF8 or UTF16ToUTF8 or UnicodeToUTF8 and many many more neat stuff to find out.

Does that help your issue Winni?
I am sorry, I do just have Windows and can not reproduce where you having problems with.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

tetrastes

  • Hero Member
  • *****
  • Posts: 538
Re: Unicode resourcestring
« Reply #12 on: February 03, 2023, 08:52:10 pm »
Unicode string means generally UTF-16. UTF-16 could be Le or Be.
Some people speaks, wrong, Unicode string for UTF-8. Please, use the exact denomination...  ;D ;D
And UnicodeString (without space) means https://www.freepascal.org/docs-html/current/ref/refsu10.html#x33-430003.2.5, as we talk about FPC here.

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Unicode resourcestring
« Reply #13 on: February 03, 2023, 10:54:00 pm »
@KodeZwerg

I know how to solve the problem.

It was just an example against your wrong statement

"Unicode is Unicode, nothing more nothing less."

Winni



KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Unicode resourcestring
« Reply #14 on: February 03, 2023, 11:23:10 pm »
@KodeZwerg

I know how to solve the problem.

It was just an example against your wrong statement

"Unicode is Unicode, nothing more nothing less."

Winni
You kidding me right?
What else is Unicode when not Unicode?
Please share me your wisdom.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

 

TinyPortal © 2005-2018