diff --git a/rdflib/plugins/serializers/nquads.py b/rdflib/plugins/serializers/nquads.py index f2ed78600..3785452bc 100644 --- a/rdflib/plugins/serializers/nquads.py +++ b/rdflib/plugins/serializers/nquads.py @@ -22,7 +22,7 @@ def __init__(self, store): def serialize(self, stream, base=None, encoding=None, **args): if base is not None: warnings.warn("NQuadsSerializer does not support base.") - if encoding is not None: + if encoding is not None and encoding.lower() != self.encoding.lower(): warnings.warn("NQuadsSerializer does not use custom encoding.") encoding = self.encoding for context in self.store.contexts(): diff --git a/rdflib/plugins/serializers/nt.py b/rdflib/plugins/serializers/nt.py index a85545f3b..77ea5e8c8 100644 --- a/rdflib/plugins/serializers/nt.py +++ b/rdflib/plugins/serializers/nt.py @@ -25,7 +25,7 @@ def __init__(self, store): def serialize(self, stream, base=None, encoding=None, **args): if base is not None: warnings.warn("NTSerializer does not support base.") - if encoding is not None: + if encoding is not None and encoding.lower() != self.encoding.lower(): warnings.warn("NTSerializer does not use custom encoding.") encoding = self.encoding for triple in self.store: