Sharing link on Twitter doesn't work for encoded slugs

AI-generated summary

A user zyouchi reports an issue where sharing a forum topic with a Japanese-encoded slug on Twitter fails because the URL isn’t recognized as a valid link. gerhard clarifies that Twitter likely doesn’t support such URLs, prompting discussion on whether Discourse should automatically encode and shorten the URL for social media sharing. codinghorror questions if it’s Twitter’s bug, but zyouchi explains it’s due to Twitter treating the encoded URL as plain text. riking suggests URL encoding before sharing, which zyouchi confirms is needed, noting similar issues with Chinese and Korean URLs. Mittineague clarifies this is a feature request, not a bug, and will be resolved via a pull request. misaka4e21 confirms the issue and links to a fix in a pull request 6257.

Hello, I would like to ask you about Slug 's Japanese response.

If I choose encoding with slug generation method, the URL will be in Japanese, but when trying to tweet from the site share button, url will not be recognized correctly.

image

Does anyone have a solution?

Could you post a link to a forum where this is happening?

Thank you for your quick reply!
ytmura.com

1 Like

What browser / OS is showing the issue? Can you post steps to reproduce the issue?
It looks alright to me.

1 Like

My problem is that the topic’s URL is not correctly recognized as a URL after being tweeted!
image

3 Likes

Oh, I didn’t try to tweet it. I guess Twitter doesn’t support such URLs. Maybe we should always share the URL without slug in that case.

2 Likes

Regarding the choice of encoding with slug generation method, I think that discourse needs to encode url and shorten it in terms of posting function to SNS.

So this is Twitter’s bug, not ours?

This is not twitter’s bug.
When sharing with Twitter, since url is recognized as a character string, Twitter can not be recognized as a URL.

So we need to urlencode it before passing off to share?

4 Likes

Yes

I think that Chinese and Korean have similar problems as well!

3 Likes

When is this bug resolved? :relieved_face:

It is not a Bug, it is a Feature request.

I expect it will be resolved once a suitable Pull Request is submitted.

2 Likes

@misaka4e21 can you have a :eyes: at this?

4 Likes

Able to reproduce.

I’m to check it.

5 Likes

https://github.com/discourse/discourse/pull/6257

11 Likes

PR has been merged in August 2018