Skip to:
Content
Pages
Categories
Search
Top
Bottom

Corrupted Turkish characters on RSS Feed


  • Ali Erkurt
    Participant

    @alierkurt

    @DJPaul Hello Paul. I’m having an RSS problem with characters. The problem is, when a new activity is published, some characters doesnt seem correctly on the feed (activity/feed) and this happens for all activities. It occurs for the Turkish characters. I’m using UTF-8 and the latest trunk of BP.

    Here’s the feed url:
    http://markeme.com/etkinlik/feed

    How can I fix that?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Bumping this so I remember to look at it later.


    kino.tv
    Member

    @minniwelt

    Same problem by german Umlauts ÄÖÜß etc.
    But only by <![CDATA[<br /> <a href="http://www.kino.tv/activity/feed/" rel="nofollow">http://www.kino.tv/activity/feed/</a>


    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


    Ali Erkurt
    Participant

    @alierkurt

    I also developed my first plugin for this issue :) It’s gonna be published soon I think.. It’ll be added to the Plugins directory as soon as it’s on air.

    Thanks.

    If I remember correctly, if you call html_entity_decode() with some character format text on PHP4 (latin1?), there is a log warning, “cannot yet handle MBCS in html_entity_decode().”

    You’re probably best putting this as a bug on https://trac.buddypress.org/ so that someone can investigate


    Ali Erkurt
    Participant

    @alierkurt

    @minniwelt OK, you can download and activate the plugin to fix your rss issue. I fixed myself with that way. Here’s the link:

    http://www.alierkurt.net/plugins/bp-rss-character-fixer.zip


    ultimateuser
    Participant

    @ultimateuser

    @alierkurt

    great work! installed the plugin and it works! was trying to fix this problem for a while now :-)


    danbpfr
    Participant

    @chouf1

    Please read here. There are also patches on trunk now:
    https://trac.buddypress.org/ticket/2194

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Corrupted Turkish characters on RSS Feed’ is closed to new replies.
Skip to toolbar