Checking for non-printable characters
Chris Sharman
Chris.Sharman@ccagroup.co.uk
Fri, 17 Sep 1999 09:02:21 +0100
>I have a request from a user to verify that all the text fields in the system
>don't contain non-printable characters (i.e. other than ASCII codes 32 - 126)
>
>Is there a reasonably neat approach that can be used to check a text field. It
>seems that it probably revolves around the use of the CHARACTERS function, but
>I can't see how to code it efficiently.
I think either a 3GL callout from Quick or matchpattern.
The docs on patterns in chapter 3 say non-printing characters not allowed, so
you'd need
def printable char*92 = '( |^|#|!!|"|!#|$|%|!&|'+&
"'|!(|!)|!*|+|,|-|.|/|!:|!;|!<|!=|!>|!?|!@|![|!\|!]|!^|!_||`|{|!||}|~)>"
not matchpattern(field,printable)
to identify all offending text fields. I suspect this would be very tedious to
code (you'd need it for every text field in every file) - a 3GL program might
be quicker to write and to run.
This would also throw out any large text fields with newlines in (allowed by
Powerhouse & entered with ctrl/P) - we use them a fair bit for large
description fields - had you forgotten them, or don't you use them ?
Chris
_______________________________________________________________________
Chris.Sharman@CCAgroup.co.uk http://www.ccastat.demon.co.uk/
CCA Stationery Ltd, Eastway, Fulwood, Preston, Lancashire, PR2 9WS.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.