From b3e0fe543f904381c970696afe659ea3d28e39fa Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Fri, 23 Dec 2022 12:21:01 +0000 Subject: [PATCH] [BUGFIX] Fix UTf-8 encoding in tables Remove duplicate utf8-encoding in multiline table content resolves https://github.com/doctrine/rst-parser/issues/177 --- lib/Nodes/Table/TableColumn.php | 2 +- .../table-grid-utf8/table-grid-utf8.html | 18 ++++++++++++++++++ .../render/table-grid-utf8/table-grid-utf8.rst | 6 ++++++ 3 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.html create mode 100644 tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.rst diff --git a/lib/Nodes/Table/TableColumn.php b/lib/Nodes/Table/TableColumn.php index dd167bec..1bf0d0a7 100644 --- a/lib/Nodes/Table/TableColumn.php +++ b/lib/Nodes/Table/TableColumn.php @@ -54,7 +54,7 @@ public function getRowSpan(): int public function addContent(string $content): void { - $this->content = trim($this->content . utf8_encode($content)); + $this->content = trim($this->content . $content); } public function incrementRowSpan(): void diff --git a/tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.html b/tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.html new file mode 100644 index 00000000..fed21edf --- /dev/null +++ b/tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.html @@ -0,0 +1,18 @@ + + + + + + + + + + + + + +
AB
x + é à +
+ é +
diff --git a/tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.rst b/tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.rst new file mode 100644 index 00000000..c305ec6c --- /dev/null +++ b/tests/Functional/tests/render/table-grid-utf8/table-grid-utf8.rst @@ -0,0 +1,6 @@ ++---+-------+ +| A | B | ++===+=======+ +| x | é à \ | +| | é | ++---+-------+