Check for special non printable character in a field
Author: lalitpct@gmail.com (lalitpct)
I would like to put a check to allow only characters in a field , blocking special character (non printable which at times corrupts database). 1)Is there way to do using syntax. 2)Below thing doesnt seems to work, as it is unable to identify non printable charactres. if (@$fieldname != '@*') message/error "Only alphanumeric characters are allowed in password" dum_new ="" return(-1) endif 3)Is there way to show them on screen. In syntax I see characters allowed -'ASCII' will this ensure to have only alphanumerics in the field. Also how to test these??
6 Comments
Local Administrator
Hi lalit, ASCII is the complete 7bit characterset including non-printables (see the helpfile page "characters allowed") your attempt using the "@*" is a reasonable one because it allows 09AZaz and the Underscore; so all we have to add is a check that no underscores are included which can be done with a simple $scan if (<$fieldname> != '@*' | $scan(<$fieldname>,"_") > 0) ; error
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
There are two wishes in the wishlist, asking for regular expression support in Uniface. Of course this will not help you now, but your vote on these wishes might convince the Uniface lab to provide a more robust solution for this problem in the future.
Author: Dennis van Duijn (dennis.van.duijn@sogeti.com)
Local Administrator
Hi Uli thanks Is t possible to print the speciall character in a message or logs..
Author: lalitpct (lalitpct@gmail.com)
Local Administrator
The easiest way: $replace all allowed characters to spaces; whats left are forbidden characters. But because you want to block even non-printables, how do you think you can print them?
Author: ulrich-merkel (ulrichmerkel@web.de)
Local Administrator
Printing Before blocking want to see what characters was blocked as when i try to show them on screen it just displays space.
Author: lalitpct (lalitpct@gmail.com)
Local Administrator
Hi lalit, it's likely that when it does not show on the screen, it will not show on the printout
Author: ulrich-merkel (ulrichmerkel@web.de)