azoner/pyx12

Tabs not being treated as invalid

Closed this issue · 0 comments

I ran across an issue where there was a tab at the end of an NMToken but it was still passing validation

The quick fix is to change the following line error on any whitespace, including tabs

if data_type in ['AN', 'ID'] and elem_val[-1] == ' ':

However, from my reading, tabs are not valid characters except in terminal control set values) and needs to fail validation whether at the end or the beginning or the middle of the string.

References found:
http://www.wpc-edi.com/reference/repository/005050cc.pdf (section B.1.1.2.2 and B.1.1.2.3 ; Terminal Control Set - B.1.1.2.4.1)
https://docs.microsoft.com/en-us/biztalk/core/edi-character-sets - The Basic character set includes the following uppercase letters, digits, space, and special characters: A through Z, 0 through 9, ! “ & ’ ( ) * + , - . / : ; ? = (space). ;
The Extended character set includes the characters in the Basic character set, and lowercase letters, select language characters, and other special characters: a through z, % @ [ ] _ { } \ | < > ~ # $.