summaryrefslogtreecommitdiff
path: root/rdflib/util.py
diff options
context:
space:
mode:
authorKempei Igarashi <kempe@iga-network.com>2020-02-21 00:34:15 +0900
committerGitHub <noreply@github.com>2020-02-21 00:34:15 +0900
commit4d77c464bfcecb500514751e9dd816ec1d46451e (patch)
tree595b0382548ad1355206172e5a9129433c9f1b37 /rdflib/util.py
parente00480271a6de85ea3e24b63c177b34340a5c2dd (diff)
downloadrdflib-4d77c464bfcecb500514751e9dd816ec1d46451e.tar.gz
fixed URIRef including native unicode characters
URIRef should be able to include native unicode like <http://ja.dbpedia.org/resource/日本> equal to <http://ja.dbpedia.org/resource/\\u65e5\\u672c>. Adding the code as same as line 185-187.
Diffstat (limited to 'rdflib/util.py')
-rw-r--r--rdflib/util.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/rdflib/util.py b/rdflib/util.py
index f0c6207d..1789aa70 100644
--- a/rdflib/util.py
+++ b/rdflib/util.py
@@ -156,7 +156,9 @@ def from_n3(s, default=None, backend=None, nsm=None):
if not s:
return default
if s.startswith('<'):
- return URIRef(s[1:-1])
+ # Hack: this should correctly handle strings with either native unicode
+ # characters, or \u1234 unicode escapes.
+ return URIRef(s[1:-1].encode("raw-unicode-escape").decode("unicode-escape"))
elif s.startswith('"'):
if s.startswith('"""'):
quotes = '"""'