From 48ff92e300696e2449070ac03b4916c76d4e77a3 Mon Sep 17 00:00:00 2001
From: Arthur de Jong <arthur@arthurdejong.org>
Date: Sun, 28 Apr 2019 23:35:42 +0200
Subject: Use an internal isdigits() function instead of str.isdigit()

The problem with the latter is that it will also accept all kinds of
unicode digits that are not the ASCII 0-9 digits causing all kinds of
problems in check digit calculations.

Some of these unicode characters are also considered digits by int() but
some are not (such as the SUPERSCRIPT TWO unicode character).

Closes https://github.com/arthurdejong/python-stdnum/issues/96
---
 stdnum/issn.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

(limited to 'stdnum/issn.py')

diff --git a/stdnum/issn.py b/stdnum/issn.py
index 07e10e8..fcd8819 100644
--- a/stdnum/issn.py
+++ b/stdnum/issn.py
@@ -51,7 +51,7 @@ InvalidLength: ...
 
 from stdnum import ean
 from stdnum.exceptions import *
-from stdnum.util import clean
+from stdnum.util import clean, isdigits
 
 
 def compact(number):
@@ -72,7 +72,7 @@ def validate(number):
     """Check if the number is a valid ISSN. This checks the length and
     whether the check digit is correct."""
     number = compact(number)
-    if not number[:-1].isdigit():
+    if not isdigits(number[:-1]):
         raise InvalidFormat()
     if len(number) != 8:
         raise InvalidLength()
-- 
cgit v1.2.3