From ca34b5191b8c878e7e9f4fd52f8c3298517e002b Mon Sep 17 00:00:00 2001 From: CWalig Date: Fri, 9 Mar 2018 10:10:50 +1300 Subject: [PATCH] Fix Indexes not being UTF16 --- Sources/bumblebee.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/bumblebee.swift b/Sources/bumblebee.swift index 1234e08..eda9698 100644 --- a/Sources/bumblebee.swift +++ b/Sources/bumblebee.swift @@ -86,8 +86,8 @@ open class Parser { if location == NSNotFound { continue } - let start = mutText.index(mutText.startIndex, offsetBy: range.location) - let end = mutText.index(mutText.startIndex, offsetBy: range.location + range.length) + let start = mutText.utf16.index(mutText.startIndex, offsetBy: range.location) + let end = mutText.utf16.index(mutText.startIndex, offsetBy: range.location + range.length) if let str = String(mutText.utf16[start..