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
url_encode()
andurl_decode()
. Both are native php functions that can be found on php.net. – kaiser Feb 23 '12 at 10:32urlencode()
instead ofstrip_tags
and add urlencode to the location var. – Jukov Feb 23 '12 at 12:35