Recent

Author Topic: Lazarus doesn't accept some characters in project names  (Read 3004 times)

440bx

  • Hero Member
  • *****
  • Posts: 3944
Lazarus doesn't accept some characters in project names
« on: July 11, 2018, 07:17:49 am »
Hello,

In Windows, a file can be named A&B.ext.  Lazarus refuses to accept a project name which contains an ampersand which is valid in Windows.

Hardly a big deal but, I thought it was worth mentioning since the ampersand is a valid character in a Windows file name.

For the record, the compiler doesn't mind the ampersand in the file name.  It compiles it as it compiles any other file.

NOTE: the ampersand is the only character that I know of so far that causes the problem but, its presence suggests there may be others.
« Last Edit: July 11, 2018, 07:19:23 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14197
  • Probably until I exterminate Putin.
Re: Lazarus doesn't accept some characters in project names
« Reply #1 on: July 11, 2018, 07:32:02 am »
AFAIK project names should follow Pascal. i.e. 0..9, _, 'A'..'z'. Anything else is by accident.
Note ampersand is part of the syntax. Even if it works on windows, seems to be a bit of a bad habit.
« Last Edit: July 11, 2018, 07:34:16 am by Thaddy »
Specialize a type, not a var.

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Lazarus doesn't accept some characters in project names
« Reply #2 on: July 11, 2018, 07:40:28 am »
the point is that the compiler accepts a file with an ampersand while Lazarus does not.  That's a discrepancy that, unless there is a really good reason, it should not exist.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

ASerge

  • Hero Member
  • *****
  • Posts: 2222
Re: Lazarus doesn't accept some characters in project names
« Reply #3 on: July 11, 2018, 10:38:58 am »
Because the "&" symbol has a special meaning for XML, which is used to store project settings, you must manually correct "&" to "&" to use it.
Work Lazarus project attached.

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: Lazarus doesn't accept some characters in project names
« Reply #4 on: July 11, 2018, 11:06:11 am »
Because the "&" symbol has a special meaning for XML, which is used to store project settings, you must manually correct "&" to "&" to use it.
Work Lazarus project attached.

Thank you Serge, it's nice to know why it doesn't accept it right off the bat and what the solution is.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

 

TinyPortal © 2005-2018