diff --git a/ulo/fix-rdf-file.py b/ulo/fix-rdf-file.py index d12a36ea3b9851938db51aba430247b74e609332..9bb25adae6f49425c12e1188c95c61232288d659 100755 --- a/ulo/fix-rdf-file.py +++ b/ulo/fix-rdf-file.py @@ -8,10 +8,20 @@ import sys def fix_quoted(s: str) -> str: payload = s.strip('"') - fixed = parse.quote(payload) - fixed = fixed.replace('http%3A', 'http:') - fixed = fixed.replace('https%3A', 'https:') - return '"%s"' % fixed + + #fixed = parse.quote(payload) + #fixed = fixed.replace('http%3A', 'http:') + #fixed = fixed.replace('https%3A', 'https:') + + bad_chars = ( + '|', '\\', ' ', '^' + ) + + for c in bad_chars: + escaped = '%' + '%X' % ord(c) + payload = payload.replace(c, escaped) + + return '"%s"' % payload def print_fixed_line(line: str):