Recent

Author Topic: Copyright symbol drives me crazy  (Read 1094 times)

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Copyright symbol drives me crazy
« on: April 07, 2020, 09:59:07 pm »
Hi,


I am unable to see what I am doing wrong here and I've been several weeks trying to figure it out.

Please, check this simple and clear line:

Code: Pascal  [Select][+][-]
  1. Label_copyrightNote.Caption := 'Copyright '+#0169+COPYRIGHT_DATES;

This code will just concatenate the text 'copyright' with the ascii code for the (c) copyright symbol and a sitring variable that hold the copyright dates. It should work I said to my self.

Well, surprise, it does not. The three screenshots belong to different forms in the same application. But only one prints
the (c) symbol corretly, the rest prints just a ? symbol.

I have checked the font being used, the codification of the label... I don't know what else. And I'm sure that there is a ridiculous easy explanation, but sorry I can't find it. Any idea?


regards,


 
« Last Edit: April 07, 2020, 10:05:21 pm by Raul_ES »
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: Copyright symbol drives me crazy
« Reply #1 on: April 07, 2020, 10:00:44 pm »
Correct symbol in this form:
« Last Edit: April 07, 2020, 10:05:51 pm by Raul_ES »
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: Copyright symbol drives me crazy
« Reply #2 on: April 07, 2020, 10:07:06 pm »
Incorrect symbol again here. I am always using the same code.
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Copyright symbol drives me crazy
« Reply #3 on: April 07, 2020, 10:15:58 pm »
Hi!

In this forum and elsewhere where years of discussion that Lazarus is

U T F 8

Take this sign

©

copy it and put as string into your source.

#0169 is today an illegal UTF8-value.

The copyright-sign value is U+00A9 = $C2A9

Winni
« Last Edit: April 07, 2020, 10:17:46 pm by winni »

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: Copyright symbol drives me crazy
« Reply #4 on: April 07, 2020, 10:20:12 pm »
Or use AnsiToUTF8() or SysToUTF8() from unit LazUTF8.
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

winni

  • Hero Member
  • *****
  • Posts: 3197
Re: Copyright symbol drives me crazy
« Reply #5 on: April 07, 2020, 10:21:38 pm »
Or use AnsiToUTF8() or SysToUTF8() from unit LazUTF8.

Yes - you are right.

But that way they will never learn how UTF8 works.

Wini
« Last Edit: April 07, 2020, 10:23:28 pm by winni »

korba812

  • Sr. Member
  • ****
  • Posts: 396
Re: Copyright symbol drives me crazy
« Reply #6 on: April 07, 2020, 10:22:38 pm »
Copyright sign encoded in utf-8 is 0xC2 0xA9
http://www.fileformat.info/info/unicode/char/a9/index.htm
Code: Pascal  [Select][+][-]
  1. Label_copyrightNote.Caption := 'Copyright '+#$c2#$a9+COPYRIGHT_DATES;
or just
Code: Pascal  [Select][+][-]
  1. Label_copyrightNote.Caption := 'Copyright ©'+COPYRIGHT_DATES;

sstvmaster

  • Sr. Member
  • ****
  • Posts: 299
Re: Copyright symbol drives me crazy
« Reply #7 on: April 07, 2020, 10:27:18 pm »
@korba812 +1
greetings Maik

Windows 10,
- Lazarus 2.2.6 (stable) + fpc 3.2.2 (stable)
- Lazarus 2.2.7 (fixes) + fpc 3.3.1 (main/trunk)

Raul_ES

  • Full Member
  • ***
  • Posts: 183
  • My interests: Healthcare & Computers
    • My Linkedin Profile, you can add me to stay in contact.
Re: Copyright symbol drives me crazy
« Reply #8 on: April 07, 2020, 10:50:24 pm »
Thank you very much! I will use from now on utf only.

but let me ask again, why +#0169+ actually works in one of my forms and not in the other ones? It's a real mistery
Pharmacy + Chemistry + Biology + Healthcare + Computing

If you have any interest or project related with these areas feel free to contact me!

 

TinyPortal © 2005-2018