twitter intent share japanese text not working in IE11

581 Views Asked by At

I have a simple share button by which twitter share url & text

https://twitter.com/intent/tweet?text=ドキドキしたい15才】 さんにおすすめのマンガは 「トレース 科捜研法医研究員の追想」 あなたも診断してみる? ⇒ &hashtags=hello&url=encodeURIComponent('https://google.com')

This is working in every browser but when IE11 its not working. Showing 400 bad request. Can anybody help me.

enter image description here

Sometimes not show 400 bad request but japanese text showing as question mark

When I open this URL into chrome then it works, after that if I copy this URL from Chrome then also work in IE but direct URL not works. Perhaps URL encoding issue. please help

2

There are 2 best solutions below

0
On BEST ANSWER

Finally The issue fixed. I have encoded text also like URL and its working in IE11 also. So I use encodeURIComponent('Japanese text') like below & then working

https://twitter.com/intent/tweet?text=encodeURIComponent('ドキドキしたい15才】 さんにおすすめのマンガは 「トレース 科捜研法医研究員の追想」 あなたも診断してみる? ⇒')&hashtags=hello&url=encodeURIComponent('https://google.com')
0
On

you need to %-Encode your URL to UTF8. IE 11 does not do this. Here's a relevant SO question:
Why Internet Explorer doesn't url-encode the urls?