Add configurable character equivalence folding for search:#6636
Open
com-master wants to merge 3 commits into
Open
Add configurable character equivalence folding for search:#6636com-master wants to merge 3 commits into
com-master wants to merge 3 commits into
Conversation
PJB3005
reviewed
Jun 15, 2026
PJB3005
left a comment
Member
There was a problem hiding this comment.
Aren't there standard Unicode systems for this? Have you investigated thoes?
|
Yup. There's casefolding obviously. But there's also per-locale collation equality which would probably be appropriate here, likely at primary strength. But this is something you really don't want to handroll. |
Author
Illiux
approved these changes
Jun 15, 2026
Author
|
Added IgnoreWidth and IgnoreKanaType. Also switched to CurrentCulture — agreed it's more correct for player-facing search since the text being searched is already rendered in the player's locale. |
Author
|
I checked failed test and i think its bug not in my code (it fails on Vulpakin profile which i didnt edit) rerun test pls if it necessary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Some languages have letters that players commonly type interchangeably, but which are technically distinct Unicode code points. The most common example is Russian ё and е: native speakers almost universally write е in informal text, but entity names in YAML may use ё, causing searches to miss results. The same problem exists in other languages (German umlauts typed without diacritics, etc.).
This PR adds a lightweight, language-agnostic mechanism to fold such characters before comparing search strings.
What changed
Robust.Shared/Utility/SearchHelpers.cs — new public static class with:
Robust.Shared/CVars.cs — new CVar interface.search_char_equivalences:
EntitySpawningUIController, TileSpawningUIController — search filters switched to ContainsSearch
Why config-driven
Hardcoding equivalences would require a code change for every new language. A CVar lets server owners, localization teams, or individual players add pairs for their language without touching the engine. The default list covers the most common cases; anything beyond that is one config line away.
Usage from game content
// No setup needed — works anywhere IoC is available
if (entityName.ContainsSearch(searchString))
...
Future work
This PR lays the groundwork in the engine. A follow-up change on the content side (Space Station 14) is planned to roll out ContainsSearch across all in-game search interfaces — crafting machines, research consoles, cargo order menus, and any other UI that filters lists by player input. Since SearchHelpers is self-initializing and requires no wiring, the content-side change is purely a find-and-replace of .Contains( with .ContainsSearch( in the relevant UI systems.