Skip to content

fix: decode HTML entities in Netease lyrics (#216)#225

Closed
VishvasJadav wants to merge 1 commit intoLambada10:masterfrom
VishvasJadav:fix/decode-html-entities-netease
Closed

fix: decode HTML entities in Netease lyrics (#216)#225
VishvasJadav wants to merge 1 commit intoLambada10:masterfrom
VishvasJadav:fix/decode-html-entities-netease

Conversation

@VishvasJadav
Copy link
Copy Markdown

Fixes #216

Problem

Lyrics fetched from the Netease provider sometimes contain HTML encoded
special characters (e.g. ä instead of ä, ü instead of ü,
ß instead of ß).

This was reported when viewing lyrics for the song "Kein Alkohol (Ist auch
keine Lösung)!" by Die Toten Hosen from Netease.

Solution

Added HTML entity decoding to NeteaseAPI.getSyncedLyrics() using
HtmlCompat.fromHtml() from AndroidX Core (already a project dependency).

The decoding is applied line-by-line to preserve the LRC timestamp format
— since Html.fromHtml() treats newlines as whitespace (standard HTML
behavior), processing each line individually ensures timestamps like
[00:15.00] and line breaks remain intact.

Changes

  • Added decodeHtmlEntities() private helper in NeteaseAPI
  • Applied decoding before returning lyrics from getSyncedLyrics()
  • No new dependencies required (uses existing androidx.core:core-ktx)

Testing

  1. Switch lyrics provider to Netease
  2. Search for "Kein Alkohol" by "Die Toten Hosen"
  3. Verify that special characters like ä, ü, ß display correctly

@harmit03
Copy link
Copy Markdown

Could this post processing be carried out in a common utility function for better maintainability?

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.

Some lyrics contain HTML encoded characters that are not decoded

2 participants