Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alphanumeric field validation is too strict #25

Open
paultiplady opened this issue Jul 26, 2016 · 1 comment
Open

alphanumeric field validation is too strict #25

paultiplady opened this issue Jul 26, 2016 · 1 comment

Comments

@paultiplady
Copy link

The logic in validate_alpha_numeric_field()(https://github.com/travishathaway/python-ach/blob/master/ach/data_types.py#L57) produces incorrect and unexpected results.

First of all, when the method encounters a non-word character (\W), it stops parsing the string. This means that the string abc/def is rendered as abc. It would be less surprising to (at least have the option to) drop forbidden characters while retaining everything else, i.e. rendering the preceding as abc def.

Second, the character set that is used is incorrect. According to the NACHA spec (Appendix 1, section 1.2):

PART 1.2 Data Specifications for ACH Records 

The following table shows the data specifications for ACH Records. 

TYPE OF FIELD ALPHABETIC/ ALPHAMERIC 

Valid Characters 

0-9, A-Z, a-z, space, EBCDIC values greater than hexadecimal “3F”, ASCII values greater than hexadecimal “1F” 

...

Certain fields require the use of UPPERCASE characters – see below. 

Any ASCII characters above 1F are valid. Reading various bank's guides to implementing NACHA files, it sounds like they may support a restricted character set in practice. Are you aware of any reason not to support the full ASCII values 0x20 and above?

I can provide a PR implementing this if you'd accept this change.

@homes32
Copy link

homes32 commented Oct 25, 2016

+1 to this PR. The parser should simply drop illegal characters replacing them with " " and continue on its merry way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants