Skip to content

Conversation

@MarcaDian
Copy link
Contributor

Fix ReVanced settings crashes when type some symbols in search #6131 (comment) and possible fixed crashes when search in Korean #6131

use Locale.ROOT in normalizeTextToLowercase() for consistent case folding

The search index and matching must be independent of the user's UI language.
Using BaseSettings.REVANCED_LANGUAGE.get().getLocale() can break case-insensitive
matching in certain locales (e.g., Turkish 'tr_TR' where 'İ'.toLowerCase() → 'i'
without dot, while 'i'.toUpperCase() → 'İ' — causing mismatches).

Locale.ROOT provides standardized, locale-neutral case conversion:
- 'İ' → 'i' (correct)
- 'ß' → 'ss'
- Consistent behavior across all languages

This ensures reliable search for Korean, Arabic, Vietnamese, and Latin scripts
regardless of the selected ReVanced language.

Fixes incorrect search behavior when UI language is Turkish, German, etc.
@MarcaDian
Copy link
Contributor Author

MarcaDian commented Nov 3, 2025

@LisoUseInAIKyrios Hello, Look into the description of the this commit.

In my language (Ukrainian), the letter "І" (or lowercase "i") in a sorted list is always at the end of the list, although in alphabetical order it should be approximately in the middle.

Maybe using a Root locale for the sorted list will solve this problem.

@LisoUseInAIKyrios LisoUseInAIKyrios changed the title fix(YouTube - Settings): Search crashes when searching for specific words fix(YouTube - Settings): Resolve settings search crash when searching for specific words Nov 3, 2025
@LisoUseInAIKyrios
Copy link
Contributor

It must be because those letters are different Unicode characters even though they look the same.

If the root locale conversion works then use that.

Replaces raw String.compareTo() with Collator to ensure correct alphabetical order for all languages (e.g., Ukrainian "і", German "ä", French "é")
@MarcaDian
Copy link
Contributor Author

It seems to me that after changing the sorting method, the ReVanced settings open with some delay.

@LisoUseInAIKyrios
Copy link
Contributor

Add some temporary performance logging to check if the sorting is slow.
See

Logger.printDebug(() -> "video: " + videoId + " took: " + (System.currentTimeMillis() - startTime) + "ms");

@MarcaDian

This comment has been minimized.

@MarcaDian

This comment has been minimized.

@LisoUseInAIKyrios
Copy link
Contributor

LisoUseInAIKyrios commented Nov 3, 2025

I only glanced at the code, but it may be repeating the string normalization for each sorting comparison. If that is the case then normalized before sorting could fix it.

@MarcaDian
Copy link
Contributor Author

MarcaDian commented Nov 3, 2025

I was wrong, the delay is not caused by sorting, but by using new method normalizeTextToLowercase() for the search function , some optimizations need to be performed.

@MarcaDian
Copy link
Contributor Author

Probably fixed.

@LisoUseInAIKyrios
Copy link
Contributor

Ready to merge?

@MarcaDian
Copy link
Contributor Author

If there are no reviews, then yes.
Everything seems to be fine.

@LisoUseInAIKyrios LisoUseInAIKyrios merged commit 76dcfae into ReVanced:dev Nov 4, 2025
1 check passed
github-actions bot pushed a commit that referenced this pull request Nov 4, 2025
# [5.46.0-dev.2](v5.46.0-dev.1...v5.46.0-dev.2) (2025-11-04)

### Bug Fixes

* **YouTube - Settings:** Resolve settings search crash when searching for specific words ([#6231](#6231)) ([76dcfae](76dcfae))
@MarcaDian MarcaDian deleted the fix-crash branch November 4, 2025 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(YouTube - Settings): Search crashes when searching for specific words

2 participants