prof18 / RSS-Parser

A Kotlin Multiplatform library to parse a RSS Feed
Apache License 2.0
524 stars 128 forks source link

String encoding #88

Closed jeffnyauke closed 3 years ago

jeffnyauke commented 3 years ago

2021-05-31 (2) The resulting strings are encoded. This should not be the case. Look at the title.

prof18 commented 3 years ago

Hi, can you share the link to the feed, so I can check it out?

jeffnyauke commented 3 years ago

https://rss.nytimes.com/services/xml/rss/nyt/Health.xml

jeffnyauke commented 3 years ago

Any feedback?

prof18 commented 3 years ago

Sorry for the delay, I'm gonna look into it in the next few days!

prof18 commented 3 years ago

I've written a test case that covers the issue you reported and it's working. Unfortunately, the item of the feed you reported is not available anymore and I have used a similar one (the title is Where the Grass is Greener, Except When It’s ‘Nonfunctional Turf’ wich is similar to ‘On That Edge of Fear’: One Woman’s Struggle With Sickle Cell Pain that you have reported)

Let me know if is working for you or if you still have the past feed so I can test it out with it.

jeffnyauke commented 3 years ago

Thank you.

I found out that I had set the Charset in the Parser object to ISO-8859-7:

val parser = Parser.Builder()
                .context(this)
                .charset(Charset.forName("ISO-8859-7"))
                .cacheExpirationMillis(24L * 60L * 60L * 100L) // one day
                .build()

But the feed was in UTF-8

I changed the charset for the Parser object to the default UTF-8 and it worked! Thank you for the help and the tests!

prof18 commented 3 years ago

Perfect! I'm glad you solved the issue.