aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_tools/normal.py
diff options
context:
space:
mode:
authorMartin Czygan <martin@archive.org>2020-01-17 14:17:05 +0000
committerMartin Czygan <martin@archive.org>2020-01-17 14:17:05 +0000
commitba40c9719059c6c33958ec25f84c40bd19712184 (patch)
tree8dbe3a29a79eeb5b8034a6c9d7da2952ce671a52 /python/fatcat_tools/normal.py
parent689da76d1c759d6368d760b4a1fa942e16095a40 (diff)
parent53756811572bab0679cb8cee1b9de95e7b29b96a (diff)
downloadfatcat-ba40c9719059c6c33958ec25f84c40bd19712184.tar.gz
fatcat-ba40c9719059c6c33958ec25f84c40bd19712184.zip
Merge branch 'martin-clean-doi' into 'master'
do not normalize "en dash" in DOI See merge request webgroup/fatcat!18
Diffstat (limited to 'python/fatcat_tools/normal.py')
-rw-r--r--python/fatcat_tools/normal.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/python/fatcat_tools/normal.py b/python/fatcat_tools/normal.py
index a77c5eb0..7b4bd19c 100644
--- a/python/fatcat_tools/normal.py
+++ b/python/fatcat_tools/normal.py
@@ -22,7 +22,10 @@ def clean_doi(raw):
if not raw:
return None
raw = raw.strip()
- raw = raw.replace('\u2013', '-') # emdash
+ if '\u2013' in raw:
+ # Do not attempt to normalize "en dash" and since FC does not allow
+ # unicode in DOI, treat this as invalid.
+ return None
if len(raw.split()) != 1:
return None
if raw.startswith("doi:"):
@@ -48,7 +51,7 @@ def test_clean_doi():
assert clean_doi("10.1037//0002-9432.72.1.50") == "10.1037/0002-9432.72.1.50"
assert clean_doi("10.1037/0002-9432.72.1.50") == "10.1037/0002-9432.72.1.50"
assert clean_doi("10.23750/abm.v88i2 -s.6506") == None
- assert clean_doi("10.17167/mksz.2017.2.129–155") == "10.17167/mksz.2017.2.129-155"
+ assert clean_doi("10.17167/mksz.2017.2.129–155") == None
assert clean_doi("http://doi.org/10.1234/asdf ") == "10.1234/asdf"
assert clean_doi("https://dx.doi.org/10.1234/asdf ") == "10.1234/asdf"
assert clean_doi("doi:10.1234/asdf ") == "10.1234/asdf"