[SharePoint BUG] RefinementToken broken for accented values — Search REST API
Target SharePoint environment
SharePoint Online
What SharePoint development model, framework, SDK or API is this about?
SharePoint REST API
Developer environment
None
What browser(s) / client(s) have you tested
- [x] 💥 Internet Explorer
- [x] 💥 Microsoft Edge
- [x] 💥 Google Chrome
- [ ] 💥 FireFox
- [ ] 💥 Safari
- [ ] mobile (iOS/iPadOS)
- [ ] mobile (Android)
- [ ] not applicable
- [ ] other (enter in the "Additional environment details" area below)
Additional environment details
- browser version
- SPFx version
- Node.js version
- etc
Describe the bug / error
Summary
The RefinementToken returned by /_api/search/postquery in RefinementResults does not work as-is in RefinementFilters when the refinement value contains non-ASCII characters such as accented characters.
The request returns 0 results silently, with no error.
Root cause
The API appears to be asymmetric in how it encodes and decodes refinement tokens:
- Token emission: the value is encoded using the hex representation of its UTF-8 bytes (
é→c3a9) - Filter matching: the token appears to be decoded using Latin-1 / character-code semantics (
é→e9)
As a result, the RefinementToken returned by the API cannot be reused as-is when it contains a multi-byte UTF-8 character.
This does not affect pure ASCII values because, for characters below 0x80, UTF-8 and Latin-1/character-code representations are identical.
This explains why values such as Security work while Sécurité fails.
The same behavior can be reproduced directly through the SharePoint Search REST API, without any client-side application logic.
Tested and ruled out: NFC/NFD normalization, lowercase, diacritic stripping,Culture: 1036 (fr-FR), double UTF-8 encoding — all returned 0. Only the charcode re-encoding (or the string(mode="phrase") FQL fallback) works.
Impact
Any refinement filter (RefinableStringXX) on a non-ASCII value breaks if the raw API token is passed back — so most FR/DE/ES/etc. taxonomies are affected.
Fix applied on our side
Decodes the API token (hex UTF-8 → text), then re-encodes it as charcode hex before putting it in RefinementFilters. Falls back to string(mode="phrase") for characters outside Latin-1 (Arabic, CJK...).
Steps to reproduce
-
Create or use a SharePoint Online Managed Metadata field mapped to a refinable managed property, for example
RefinableStringXX. -
Add a taxonomy value containing an accented character, for example:
Sécurité -
Execute a Search REST API request using
/_api/search/postquerywith:{ "request": { "Querytext": "*", "QueryTemplate": "{searchTerms} PromotedState:2", "Refiners": "RefinableStringXX", "RowLimit": 10 } } -
In the
RefinementResults, locate the refinement corresponding toSécurité. -
Copy the
RefinementTokenreturned by SharePoint. (starting byǂǂ....) -
Use the returned
RefinementTokendirectly inRefinementFilters. -
The request completes successfully but returns 0 results
Same request, only the encoding of é inside the token changes:
...437962657273c3a96375726... (UTF-8) → 0 results
...437962657273e96375726... (charcode) → 10 results ✔ (matches the expected RefinementCount)
Expected behavior
The RefinementToken returned by RefinementResults should be directly reusable in RefinementFilters.
A token returned by: RefinementResults should produce the corresponding refinement results when passed unchanged to:
RefinementFilters
Non-ASCII characters should be handled consistently between token generation and token matching.
Here are a few other threads about the same issue:
https://github.com/microsoft-search/pnp-modern-search/issues/4926 https://github.com/microsoft-search/pnp-modern-search/issues/4901
I have an ongoing support case with Microsoft about this and also posted here, https://sharepoint.stackexchange.com/questions/317496/issue-with-the-sharepoint-search-api-and-refiners-containing-accented-characters, for increased visibilty.
Hello @Jsss1010 Thank you for bringing this issue to our attention. We will look into it and get back to you shortly.
We are experiencing the same issue with Swedish characters (ö,å,ä).
@Jsss1010 Thanks for the detailed repro steps and the additional context from the linked threads. We attempted to reproduce this in an internal test tenant:
- Created a Managed Metadata column mapped to a taxonomy term containing an accented character (Sécurité), added it to list items, and mapped the corresponding crawled property to a RefinableString managed property.
- Confirmed base content crawling works correctly for the list (items are indexed and searchable).
- However, the taxonomy-column-specific crawled property has not yet surfaced in our test tenant even after multiple forced reindexes and an extended wait, so we have not yet been able to complete the RefinementResults → RefinementFilters round-trip test end-to-end to directly observe the 0-result behavior described.
- Given that other reporters describe this as intermittent (working in some environments/timeframes but not others), this may depend on specific search infrastructure/tenant state rather than being reliably reproducible via a fresh minimal setup.
I will tag the engineering team internally for confirmation on the backend encoding/decoding behavior and will update this thread once we hear back.
@Ashlesha-MSFT We are experiencing this in most tenants we have checked (Sweden), at least 5 production tenants and 2 dev. I've been searching for a working tenants to verify workaround and only found 1 production and 1 dev that work correctly. In affected tenants the issue is consistent, happens all the time and as far as we know for all users.
But there is a separate issue that seems to be affecting investigation - crawled properties for newly created columns stopped appearing at all in some tenants. In some, previously existing properties disappeared as well. We have active support requests with Microsoft Support for both the refinement issue and the crawled properties.
@Jsss1010 Thank you so much for sharing your findings!
@Ashlesha-MSFT If I may suggest a modification to repro steps, so that no new crawled properties are needed: you can have a user with Sécurité as display name and after creating some documents use the query with DisplayAuthor instead of RefinableStringXX.
We experience the same problem on our tenant using Danish letters like æøå. From contact with MS support technician, we tried to create a new text column and map it to a refinable string. However, we could not find this new crawled property or several other existing crawled properties when trying to map it. Seems like something really has been messed up.
Just to confirm the comments from @msznwska and @sorenbromand I think there are wider issues here, as we are also seeing managed and crawled properties not appearing in the Schema page, plus search results retrieved and displayed via the PnP Modern Search controls that were working last week now either coming back with no results or 500 errors.
Has MS support came back with any feedback on these issues?
I have an ongoing support case with Microsoft regarding this. They are working on deploying a fix, but there is no timeframe yet.
Microsoft has finally realized that there is a problem. They have no timeframe for a solution, but they talk about end of September.
Thanks @patrikhellgren and @sorenbromand for the update.
I have been able to fix the affected web parts in our tenant by removing the sort order (that was Title) and optionally replacing it by a sort by Filename instead. No idea why that works!
How (even if) this ties up with this particular issue I don't know, but as an en-GB tenant we wouldn't be using a lot of accents/non-ASCII characters. Perhaps our issue ties up more with the issue of managed properties not showing in the schema...?!? 🤔
For those who are troubled with this problem, it seems like that the bug is corrected by MS related to report alerts/MO1456424. It is working now at our side while testing with the French accent 'é'. @patrikhellgren @msznwska @sbrown-fc @sorenbromand @Ashlesha-MSFT
@Jsss1010 The MO1456424 shows end date as August 21 and we were experiencing the issue after that. The start day of that alert is also later than when we started experiencing the issue. We've noticed it on August 6, but it's possible it started even earlier.
I checked two tenants I am currently logged in to and unfortunately refining on values with öäå still gives no results. In our custom app where we applied your encoding workaround it works correctly.
@Jsss1010 I was in contact with Microsoft support last Friday (28th of august) and they had no timeframe of the rollout so no fix has started rolling out yet. They say it is now a known issue and is currently being fixed.
Any updates on this matter? It's a major issue that makes pnp filtering fail for a month now. Especially since SharePoint std. does not handle filtering of large document libraries well so alternatives are few.
We have also noticed this issue in several tenants (sweden), and the problem still persists. Does anyone know if it is the same issue affecting refiners configured in the Microsoft 365 Search & Intelligence Admin Center?
@patrikhellgren Have you received any additional information related to the support case?
@FredrikThorn If you mean the custom verticals for Microsoft Search, then yes we have confirmed that the issue is there as well.
We are also seeing the issue in classic search and PnP Modern Search web parts.
@FredrikThorn I received the latest follow-up yesterday and the MS team is still working on it and no ETA yet.
We are experiencing changes in this issue today. Filters are not back to working like before but something has changed and some results are shown with special chars.
Do you see similar results?
I got an email from MS today saying that they were rolling out a solution. I tested and everything seems to work on our tenant. One thing still not working is the total number of search results. It shows 400 even though we have more than 3000 results.