arthurdejong / python-stdnum

A Python library to provide functions to handle, parse and validate standard numbers.
https://arthurdejong.org/python-stdnum/
GNU Lesser General Public License v2.1
498 stars 206 forks source link

Dominican RNC - escape new line character #232

Closed evaldez89 closed 4 years ago

evaldez89 commented 4 years ago

Current situation: the request crashes when consulting a RNC which result contains a new line character (\n) on the name.

The code is already scaping the tab character (\t).

When debugging making the request with the RNC 132070801, we can see the response, the issue is when converting the result: ~stdnum/do/rnc.py(147) image

It crashes when trying to _convert_result ~stdnum/do/rnc.py(115) image

I propose scaping the \n replacing it with \\n

for key, value in json.loads(result.replace('\n', '\\n').replace('\t', '\\t')).items())
arthurdejong commented 4 years ago

Thanks for reporting this. It is fixed in feca1fe (I've also added a test for this situation).