Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Corrupted Turkish characters on RSS Feed


Ali Erkurt
Participant

@alierkurt

OK, I fixed that by myself :)

Paul has a lot to do I guess… Right @DJPaul? :)

OK @minniwelt I’m sure you’re expecting to see the fix. Here’s the solution:

In bp-activity-templatetags.php file, line 911, you’ll see that:

$title = trim( strip_tags( html_entity_decode( utf8_encode( $content[0] ) ) ) );

What causes the corrupted characters is “utf8_encode” thing. I’m already using my site as UTF-8. So second attempt for the UTF-8 might be the problem. I defined a new function for myself and problem solved. Put this function to your theme’s functions.php file:

//feed character correction function by alierkurt.net
function rssfeedcharcorrection() {
global $activities_template;

if ( !empty( $activities_template->activity->action ) )
$content = $activities_template->activity->action;
else
$content = $activities_template->activity->content;

$content = explode( ‘<span', $content );
$title = trim( strip_tags( html_entity_decode( $content[0] ) ) );

if ( ‘:’ == substr( $title, -1 ) )
$title = substr( $title, 0, -1 );

if ( ‘activity_update’ == $activities_template->activity->type )
$title .= ‘: ‘ . strip_tags( bp_create_excerpt( $activities_template->activity->content, 15 ) );

return apply_filters( ‘rssfeedcharcorrection’, $title );
}
add_filter(‘bp_get_activity_feed_item_title’, ‘rssfeedcharcorrection’);

That’s all! And let me know if this works for you too…

Wow! I’m becoming a better developer every single day :) I think I’m gonna rock BP community soon… :D

Skip to toolbar