From 4137b37329bd821a32b03c9494b47d2503c282af Mon Sep 17 00:00:00 2001 From: Marco Sanvito <46250330+koalas11@users.noreply.github.com> Date: Thu, 14 Dec 2023 16:20:19 +0100 Subject: [PATCH] Fix for decodeEntities when parsing an html string in parts --- .../com/mohamedrejeb/ksoup/html/tokenizer/KsoupTokenizer.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ksoup-html/src/commonMain/kotlin/com/mohamedrejeb/ksoup/html/tokenizer/KsoupTokenizer.kt b/ksoup-html/src/commonMain/kotlin/com/mohamedrejeb/ksoup/html/tokenizer/KsoupTokenizer.kt index a9bf6b4..27ee32e 100644 --- a/ksoup-html/src/commonMain/kotlin/com/mohamedrejeb/ksoup/html/tokenizer/KsoupTokenizer.kt +++ b/ksoup-html/src/commonMain/kotlin/com/mohamedrejeb/ksoup/html/tokenizer/KsoupTokenizer.kt @@ -515,7 +515,7 @@ internal class KsoupTokenizer( private fun stateInEntity(c: Int) { if (c == CharCodes.Semi.code) { val decoded = KsoupEntities.decodeHtml( - this.buffer.substring(this.entityStart, this.index + 1) + this.buffer.substring(this.entityStart - this.offset, this.index - this.offset + 1) ) this.state = this.baseState @@ -874,4 +874,4 @@ internal class KsoupTokenizer( } } -} \ No newline at end of file +}