Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-08

Edti's password char with bug?

8 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

William Oliveira Ferreira

I like to use a ? (ascii 158) as a password char, it?s clean, easy to read and count, but int (win) lazarus, i can?t set it as password char. When i set it, i becames an asterisk (*). This doesn?t heappen when i set a common letters as vowels and consonants.

Maibe i found a bug?
__________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110810/3d50992c/attachment.html>

Reply by email

William Oliveira Ferreira
to William Oliveira Ferreira

Sorry, i forgot my laz/fpc version:
Laz: 0.9.30
Date: 08-03-2011
FPC:Version: 2.4.2
SVN Version: 29749
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o

2011/8/10 William Oliveira Ferreira

Show quoted text 10 lines
I like to use a ? (ascii 158) as a password char, it?s clean, easy to read and count, but int (win) lazarus, i can?t set it as password char. When i set it, i becames an asterisk (*). This doesn?t heappen when i set a common letters as vowels and consonants. Maibe i found a bug? __________ William de Oliveira Ferreira Bacharel em Sistemas de Informa??o

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110810/516541db/attachment.html>

Reply by email

Gerard Visent
to William Oliveira Ferreira: I like to use a ? (ascii 158) as a password char, it?s clean, easy to read and count, but…

Hi William,

2011/8/10 William Oliveira Ferreira

Show quoted text 5 lines
I like to use a ? (ascii 158) as a password char, it?s clean, easy to read and count, but int (win) lazarus, i can?t set it as password char. When i set it, i becames an asterisk (*). This doesn?t heappen when i set a common letters as vowels and consonants.

It works for me in Windows XP with SVN 31926. I can set 'x', 'X' and that's what I see.

Maibe i found a bug?

Possible, but it may have been fixed since SVN 29749. That doesn't work with GTK2 under Linux though. :-(

Regards,

Gerard.

Show quoted text 11 lines
__________ William de Oliveira Ferreira Bacharel em Sistemas de Informa??o -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110810/6c9b848a/attachment-0001.html>

Reply by email

Martin
to Gerard Visent
Gerard Visent wrote 20 lines
Hi William, 2011/8/10 William Oliveira Ferreira < <mailto:>> I like to use a ? (ascii 158) as a password char, it?s clean, easy to read and count, but int (win) lazarus, i can?t set it as password char. When i set it, i becames an asterisk (*). This doesn?t heappen when i set a common letters as vowels and consonants. It works for me in Windows XP with SVN 31926. I can set 'x', 'X' and that's what I see. Maibe i found a bug? Possible, but it may have been fixed since SVN 29749. That doesn't work with GTK2 under Linux though. :-(

Hm, on my system 158 results in a "z" with some tilde or accent.

But that is probably the correct behaviour.

For some reason the PassWordchar field accepts an ansi char, rather than a utf8 char. So what you will see depends on the codepage of the system on which your app is run. Even if it displays fine on your PC, if you ship the app, other people will see other chars.

How or why it becomes an * I do not know...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110810/624d2cde/attachment.html>

Reply by email

Gerard Visent
to Martin

Hi Martin,

Hm, on my system 158 results in a "z" with some tilde or accent.

Same here.

Show quoted text 10 lines
But that is probably the correct behaviour. For some reason the PassWordchar field accepts an ansi char, rather than a utf8 char. So what you will see depends on the codepage of the system on which your app is run. Even if it displays fine on your PC, if you ship the app, other people will see other chars. How or why it becomes an * I do not know...

I found why, but I can't explain the reason behind the code. In lcl/interfaces/gtk2/gtk2wsstdctrls :

class procedure TGtk2WSCustomEdit.SetPasswordChar(
  const ACustomEdit: TCustomEdit; NewChar: char);
var
  PWChar: Integer;
  Entry: PGtkEntry;
begin
  if not WSCheckHandleAllocated(ACustomEdit, 'SetPasswordChar') then
    Exit;
  Entry := PGtkEntry(ACustomEdit.Handle);
  if ACustomEdit.EchoMode=emNone then
    PWChar:=0
  else begin
    PWChar:=ord(ACustomEdit.PasswordChar);
    if (PWChar<192) or (PWChar=ord('*')) then
      PWChar:=9679;
  end;
  gtk_entry_set_invisible_char(Entry,PWChar);
end;

Commenting the following lines

  if (PWChar<192) or (PWChar=ord('*')) then
      PWChar:=9679;

allows to display any char. But there must be a reason for this check and whoever wrote didn't bother writing a comment.

Regards,

Gerard.

Show quoted text 8 lines
-- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110810/8014bbb9/attachment.html>

Reply by email

Vincent Snijders
to Gerard Visent

2011/8/10 Gerard Visent :

Show quoted text 23 lines
class procedure TGtk2WSCustomEdit.SetPasswordChar( ? const ACustomEdit: TCustomEdit; NewChar: char); var ? PWChar: Integer; ? Entry: PGtkEntry; begin ? if not WSCheckHandleAllocated(ACustomEdit, 'SetPasswordChar') then ??? Exit; ? Entry := PGtkEntry(ACustomEdit.Handle); ? if ACustomEdit.EchoMode=emNone then ??? PWChar:=0 ? else begin ??? PWChar:=ord(ACustomEdit.PasswordChar); ??? if (PWChar<192) or (PWChar=ord('*')) then ????? PWChar:=9679; ? end; ? gtk_entry_set_invisible_char(Entry,PWChar); end; Commenting the following lines ? if (PWChar<192) or (PWChar=ord('*')) then ????? PWChar:=9679;

Maybe Mattias remembers:
http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/lcl/interfaces/gtk2/gtk2wsstdctrls.pp?root=lazarus&r1=11027&r2=11028

You see this char ( ? ,
http://www.unicodemap.org/details/0x25CF/index.html) a lot in sample code, but I see no reason why to replace all (PWChar<192). I can imagine the replacement is done for *, to make the control look more similar to other password controls.

Vincent

Reply by email

William Oliveira Ferreira
to Gerard Visent: Same here. I found why, but I can't explain the reason behind the code. In…

But that code runs under GTK2 and i have this problem on Windows Seven Home Basic (Where i tested), at night (now here is 05:28 PM) i'll test it on my Debian 6/Gnome 2
________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o

2011/8/10 Gerard Visent

Show quoted text 72 lines
Hi Martin, > > Hm, on my system 158 results in a "z" with some tilde or accent. > Same here. > > But that is probably the correct behaviour. > > For some reason the PassWordchar field accepts an ansi char, rather than a > utf8 char. So what you will see depends on the codepage of the system on > which your app is run. Even if it displays fine on your PC, if you ship the > app, other people will see other chars. > > How or why it becomes an * I do not know... > I found why, but I can't explain the reason behind the code. In lcl/interfaces/gtk2/gtk2wsstdctrls : class procedure TGtk2WSCustomEdit.SetPasswordChar( const ACustomEdit: TCustomEdit; NewChar: char); var PWChar: Integer; Entry: PGtkEntry; begin if not WSCheckHandleAllocated(ACustomEdit, 'SetPasswordChar') then Exit; Entry := PGtkEntry(ACustomEdit.Handle); if ACustomEdit.EchoMode=emNone then PWChar:=0 else begin PWChar:=ord(ACustomEdit.PasswordChar); if (PWChar<192) or (PWChar=ord('*')) then PWChar:=9679; end; gtk_entry_set_invisible_char(Entry,PWChar); end; Commenting the following lines if (PWChar<192) or (PWChar=ord('*')) then PWChar:=9679; allows to display any char. But there must be a reason for this check and whoever wrote didn't bother writing a comment. Regards, Gerard. > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > > -- _______________________________________________ Lazarus mailing list http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110810/634a6baa/attachment-0001.html>

Reply by email

William Oliveira Ferreira
to William Oliveira Ferreira

i?ve tested on my debian and any of the passwordChars that i've set makes difference...

________________________________
William de Oliveira Ferreira
Bacharel em Sistemas de Informa??o

2011/8/10 William Oliveira Ferreira

Show quoted text 85 lines
But that code runs under GTK2 and i have this problem on Windows Seven Home Basic (Where i tested), at night (now here is 05:28 PM) i'll test it on my Debian 6/Gnome 2 ________________________________ William de Oliveira Ferreira Bacharel em Sistemas de Informa??o 2011/8/10 Gerard Visent > Hi Martin, > >> >> Hm, on my system 158 results in a "z" with some tilde or accent. >> > > Same here. > > >> >> But that is probably the correct behaviour. >> >> For some reason the PassWordchar field accepts an ansi char, rather than >> a utf8 char. So what you will see depends on the codepage of the system on >> which your app is run. Even if it displays fine on your PC, if you ship the >> app, other people will see other chars. >> >> How or why it becomes an * I do not know... >> > > I found why, but I can't explain the reason behind the code. > In lcl/interfaces/gtk2/gtk2wsstdctrls : > > class procedure TGtk2WSCustomEdit.SetPasswordChar( > const ACustomEdit: TCustomEdit; NewChar: char); > var > PWChar: Integer; > Entry: PGtkEntry; > begin > if not WSCheckHandleAllocated(ACustomEdit, 'SetPasswordChar') then > Exit; > Entry := PGtkEntry(ACustomEdit.Handle); > if ACustomEdit.EchoMode=emNone then > PWChar:=0 > else begin > PWChar:=ord(ACustomEdit.PasswordChar); > if (PWChar<192) or (PWChar=ord('*')) then > PWChar:=9679; > end; > gtk_entry_set_invisible_char(Entry,PWChar); > end; > > Commenting the following lines > > if (PWChar<192) or (PWChar=ord('*')) then > PWChar:=9679; > > allows to display any char. But there must be a reason for this check and > whoever wrote didn't bother writing a comment. > > Regards, > > Gerard. > > > >> >> -- >> _______________________________________________ >> Lazarus mailing list >> >> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus >> >> > > -- > _______________________________________________ > Lazarus mailing list > > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus > >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus/attachments/20110812/28c772e8/attachment-0001.html>

Reply by email