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


I get


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

  • 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

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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