Added decoding for feed item titles to remove odd entities

This commit is contained in:
RyanBateman 2012-10-19 11:57:28 -04:00
parent 7942445442
commit 7662c69c35

View file

@ -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;
}