[PR #3113] [MERGED] Make building of search results work for multi-byte encoded characters #6141

Closed
opened 2026-02-05 10:25:20 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/BookStackApp/BookStack/pull/3113
Author: @Kristian-Krastev
Created: 12/15/2021
Status: Merged
Merged: 12/18/2021
Merged by: @ssddanbrown

Base: masterHead: fix/multibyte-safe-search


📝 Commits (1)

  • d0fd1b7 Make building of search results work for multi-byte encoded characters

📊 Changes

2 files changed (+20 additions, -20 deletions)

View changed files

📝 app/Entities/Tools/PageContent.php (+1 -1)
📝 app/Entities/Tools/SearchResultsFormatter.php (+19 -19)

📄 Description

When a search is made, the information that is shown in every result snippet is taken from database tables 'bookshelves', 'books', 'chapters', 'pages', but the string data in them may be encoded in format different than one-to-one byte format. For example for every cyrillic character are used up to four bytes for representation.

Operations on strings in this context are not multi-byte safe and the returned snippets contain 'broken' information.
I think the multibyte string methods are a good alternative for the solution of that problem.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/BookStackApp/BookStack/pull/3113 **Author:** [@Kristian-Krastev](https://github.com/Kristian-Krastev) **Created:** 12/15/2021 **Status:** ✅ Merged **Merged:** 12/18/2021 **Merged by:** [@ssddanbrown](https://github.com/ssddanbrown) **Base:** `master` ← **Head:** `fix/multibyte-safe-search` --- ### 📝 Commits (1) - [`d0fd1b7`](https://github.com/BookStackApp/BookStack/commit/d0fd1b7f5cabcae1809ef98ca9483c90a8899f29) Make building of search results work for multi-byte encoded characters ### 📊 Changes **2 files changed** (+20 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `app/Entities/Tools/PageContent.php` (+1 -1) 📝 `app/Entities/Tools/SearchResultsFormatter.php` (+19 -19) </details> ### 📄 Description When a search is made, the information that is shown in every result snippet is taken from database tables 'bookshelves', 'books', 'chapters', 'pages', but the string data in them may be encoded in format different than one-to-one byte format. For example for every cyrillic character are used up to four bytes for representation. Operations on strings in this context are not multi-byte safe and the returned snippets contain 'broken' information. I think the multibyte string methods are a good alternative for the solution of that problem. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 10:25:20 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#6141