Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to create Google calendar links from posts, I do it like so:

$base_url = 'http://www.google.com/calendar/event';
        $params = array(
            'action' => 'TEMPLATE',
            'text' => strip_tags(get_the_title()),
            'dates' => $dates,
            'details' => strip_tags( get_the_excerpt() ),
            'location' => $location,
            'sprop' => get_option('blogname'),
            'trp' => 'false',
            'sprop' => 'website:' . home_url()
        );
        $url = add_query_arg( $params, $base_url );
        return esc_html($url);

but IE reads UTF-8 chrachters in URL as percent-encoded (this is a general issue, because the standard "pretty urls" are precent-encoded in IE as well), so instead of

someurl.com/שלום

I get

someurl.com/%D7%A9%D7%9C%D7%95%D7%9D

Is there a solution for this problem on WP side? I'm not sure how to tackle this issue, could it be in WP core or is there something I can do for my generated calendar urls. I must note that FX and Chrome encode the characters correctly. Thanks

share|improve this question
    
Take a look at url_encode() and url_decode(). Both are native php functions that can be found on php.net. –  kaiser Feb 23 '12 at 10:32
    
@kaiser and @David Gard, thank you guys . All I needed to do was urlencode() instead of strip_tags and add urlencode to the location var. –  Jukov Feb 23 '12 at 12:35

1 Answer 1

up vote 0 down vote accepted

Have a look at the PHP function urlencode(), that will hopefully help.

Also, in the latest update of Wordpress (3.3.1) they have fixed it so that permalinks (post slugs) no longer contain special characters. This of course doesn't help with your already existing slugs, but I'm sure there are ways and means of cleaning that field in your database.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.