diff --git a/bluebell/__init__.py b/bluebell/__init__.py index 8a124bf..55e4709 100644 --- a/bluebell/__init__.py +++ b/bluebell/__init__.py @@ -1 +1 @@ -__version__ = "2.2.0" +__version__ = "2.3.0" diff --git a/bluebell/xml.py b/bluebell/xml.py index 8eab080..4f3977d 100644 --- a/bluebell/xml.py +++ b/bluebell/xml.py @@ -245,7 +245,7 @@ def xml_from_dict(self, tree, is_root=False): def xml_from_tree(self, tree): """ Transform an entire parse tree to XML. """ - return etree.fromstring(etree.tostring(self.item_to_xml(tree), encoding='unicode')) + return etree.fromstring(etree.tostring(self.item_to_xml(tree), encoding='utf-8')) def item_to_xml(self, item): return getattr(self, f'item_to_xml_{item["type"]}')(item) @@ -510,7 +510,7 @@ def add_meta(self, xml): if not self.frbr_uri: raise ValueError("An frbr_uri must be provided when generating top-level documents.") - meta = etree.fromstring(etree.tostring(self.make_meta(self.frbr_uri, True))) + meta = etree.fromstring(etree.tostring(self.make_meta(self.frbr_uri, True), encoding='utf-8')) list(xml)[0].insert(0, meta) return xml diff --git a/pyproject.toml b/pyproject.toml index cf3be35..cc5acb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ "Programming Language :: Python :: 3", ] dependencies = [ - "cobalt>=7.0.0", + "cobalt>=8.0.0", "lxml>=3.4.1", ] dynamic = ["version"] diff --git a/tests/roundtrip/act.txt b/tests/roundtrip/act.txt index c3d2817..d66a5d9 100644 --- a/tests/roundtrip/act.txt +++ b/tests/roundtrip/act.txt @@ -10,6 +10,8 @@ CHAP 1 - Heading SEC.custom-class{status edited} 1 - Section + emoji 😀 + some **text** at //the start// with **multiple //types// of** markup \***\*Notice**s\*\* diff --git a/tests/test_round_trip.py b/tests/test_round_trip.py index 0d256cc..f2ed0d8 100644 --- a/tests/test_round_trip.py +++ b/tests/test_round_trip.py @@ -31,7 +31,7 @@ def roundtrip(self, prefix, root): self.assertMultiLineEqual(input, actual) # ensure it validates - doc = StructuredDocument.for_document_type(root)(etree.tostring(xml, encoding='unicode')) + doc = StructuredDocument.for_document_type(root)(etree.tostring(xml, encoding='utf-8')) assert_validates(doc, strict=False) def roundtrip_xml(self, file_in, root='statement'):