mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Added decoding for feed item titles to remove odd entities
This commit is contained in:
parent
7942445442
commit
7662c69c35
1 changed files with 11 additions and 1 deletions
|
@ -1,10 +1,14 @@
|
|||
package com.newsblur.view;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.support.v4.widget.SimpleCursorAdapter.ViewBinder;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
|
@ -14,6 +18,7 @@ import com.newsblur.domain.Story;
|
|||
|
||||
public class FeedItemViewBinder implements ViewBinder {
|
||||
|
||||
private static final String TAG = "FeedItemViewBinder";
|
||||
private final Context context;
|
||||
private int darkGray;
|
||||
private int lightGray;
|
||||
|
@ -62,7 +67,12 @@ public class FeedItemViewBinder implements ViewBinder {
|
|||
((TextView) view).setText("");
|
||||
return true;
|
||||
} else if (TextUtils.equals(columnName, DatabaseConstants.STORY_TITLE)) {
|
||||
((TextView) view).setText(Html.fromHtml(cursor.getString(columnIndex)));
|
||||
try {
|
||||
((TextView) view).setText(Html.fromHtml(URLDecoder.decode(cursor.getString(columnIndex), "UTF-8")));
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
((TextView) view).setText(Html.fromHtml(cursor.getString(columnIndex)));
|
||||
Log.e(TAG, "Error decoding from title string");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue