Skip to content

Commit

Permalink
Merge pull request #449 from Outlet7493/unicode-regex
Browse files Browse the repository at this point in the history
Fix unicode search suggestions
  • Loading branch information
lamarios authored Jan 11, 2024
2 parents 8abb046 + f7738a5 commit 5468e54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions lib/service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,14 +368,10 @@ class Service {
SearchSuggestion.fromJson(handleResponse(response));
if (search.suggestions.any((element) => element.contains(";"))) {
search.suggestions = search.suggestions
.map((s) => s
.replaceAll(" ", " ")
.split(";")
.where((e) => e.isNotEmpty && e.startsWith("&#"))
.map(
(e) => String.fromCharCode(int.parse(e.replaceAll("&#", ""))))
.toList()
.join(""))
.map((s) => s.replaceAll(" ", " ").replaceAllMapped(
RegExp(r"&#\w*;"),
(m) => String.fromCharCode(
int.parse(m[0]!.replaceAll(RegExp(r"&#|;"), "")))))
.toList();
}

Expand Down

0 comments on commit 5468e54

Please sign in to comment.