非英语使用者的Facebook分享问题 [英] Facebook Share problem for Non English Urls

查看:67
本文介绍了非英语使用者的Facebook分享问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个阿拉伯语网站,我们正在尝试在脸书上共享一个网址.网址看起来像

We have an arabic website and we are trying to share a Url on face book. The Url looks like

http://www.website.com/ar /شاهدى-عروض-الأزياء-العالمية- بعيون-عربية/موضة/story/75

http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75

问题在于,facebook没有在上述链接上显示缩略图. 当我们通过提琴手进行调试时,我们发现facebook尝试访问的URL与上面给出的URL不同,该URL就像

The problem is that the facebook does not get thumbnails present on the above link. When we debugged this through fiddler, we found that the url that facebook is trying to access is not the same as given above, this url is like

www.website.com/ar/%c3%98%c2%b4%c3%98%c2%a7%c3%99%e2%80%a1%c3%98%c2%af%c3%99% e2%80%b0-%c3%98%c2%b9%c3%98%c2%b1%c3%99%cb%86%c3%98%c2%b6-%c3%98%c2%a7%c3% 99%e2%80%9e%c3%98%c2%a3%c3%98%c2%b2%c3%99%c5%a0%c3%98%c2%a7%c3%98%c2%a1-%c3 %98%c2%a7%c3%99%e2%80%9e%c3%98%c2%b9%c3%98%c2%a7%c3%99%e2%80%9e%c3%99%e2%80 %a6%c3%99%c5%a0%c3%98%c2%a9-%c3%98%c2%a8%c3%98%c2%b9%c3%99%c5%a0%c3%99%cb% 86%c3%99%e2%80%a0-%c3%98%c2%b9%c3%98%c2%b1%c3%98%c2%a8%c3%99%c5%a0%c3%98%c2 %a9/%c3%99%e2%80%a6%c3%99%cb%86%c3%98%c2%b6%c3%98%c2%a9/story/75

www.website.com/ar/%c3%98%c2%b4%c3%98%c2%a7%c3%99%e2%80%a1%c3%98%c2%af%c3%99%e2%80%b0-%c3%98%c2%b9%c3%98%c2%b1%c3%99%cb%86%c3%98%c2%b6-%c3%98%c2%a7%c3%99%e2%80%9e%c3%98%c2%a3%c3%98%c2%b2%c3%99%c5%a0%c3%98%c2%a7%c3%98%c2%a1-%c3%98%c2%a7%c3%99%e2%80%9e%c3%98%c2%b9%c3%98%c2%a7%c3%99%e2%80%9e%c3%99%e2%80%a6%c3%99%c5%a0%c3%98%c2%a9-%c3%98%c2%a8%c3%98%c2%b9%c3%99%c5%a0%c3%99%cb%86%c3%99%e2%80%a0-%c3%98%c2%b9%c3%98%c2%b1%c3%98%c2%a8%c3%99%c5%a0%c3%98%c2%a9/%c3%99%e2%80%a6%c3%99%cb%86%c3%98%c2%b6%c3%98%c2%a9/story/75

我需要知道facebook对显示的网址做了什么. 我知道的一件事是,此网址不是UTF8编码的.如果将给定的阿拉伯网址转换为UTF8,则看起来像是以下内容,而不是上面的内容

I need to know what facebook did to the url that it became as shown. One more thing that i know is that this url is not UTF8 encoded. If the given arabic url is converted to UTF8 then it looks like following and not as above

www.website.com/ar/%D8%B4%D8%A7%D9%87%D8%AF%D9%89-%D8%B9%D8%B1%D9%88%D8%B6-% D8%A7%D9%84%D8%A3%D8%B2%D9%8A%D8%A7%D8%A1-%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9 %85%D9%8A%D8%A9-%D8%A8%D8%B9%D9%8A%D9%88%D9%86-%D8%B9%D8%B1%D8%A8%D9%8A%D8 %A9/%D9%85%D9%88%D8%B6%D8%A9/故事/75

www.website.com/ar/%D8%B4%D8%A7%D9%87%D8%AF%D9%89-%D8%B9%D8%B1%D9%88%D8%B6-%D8%A7%D9%84%D8%A3%D8%B2%D9%8A%D8%A7%D8%A1-%D8%A7%D9%84%D8%B9%D8%A7%D9%84%D9%85%D9%8A%D8%A9-%D8%A8%D8%B9%D9%8A%D9%88%D9%86-%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9/%D9%85%D9%88%D8%B6%D8%A9/story/75

因此,当我们共享网址时,我需要知道脸书使用的是哪种编码方式,或者facebook正在做什么来访问以下网址

So i need to know which encoding the face book is using or what facebook is doing to access the following url when we share the url

www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75

www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75

推荐答案

http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75

这不是 URI (或URL).这是 IRI .不幸的是,许多软件不直接支持IRI(包括SO,正如您从它仅链接地址的第一部分所看到的那样!).

That's not a URI (or URL). It's an IRI. Unfortunately a lot of software doesn't support IRI directly (including SO, as you can see from the way it has linked only the first part of the address!).

因此,如果您希望链接在任何地方都可以使用,则必须将其编写为带有UTF-8-URL编码路径名的纯URI,如上一个示例(%D8%B4 ...)所示.无论HTML文档中的链接是纯URI,浏览器通常都会在地址栏中将编码后的链接显示为漂亮的IRI.

So if you want the link to work everywhere you'll have to write it up as a plain URI with UTF-8-URL-encoded pathnames, as in the last example (%D8%B4...). Browser will usually present the encoded link in the address bar as a nice IRI regardless of the link in the HTML document being plain URI.

%c3%98%c2%b4 ...是获取UTF-8编码的字节并将其视为ISO-8859-1-编码(然后再次对其进行UTF-8-URL编码)后得到的结果,给出一个破损的双UTF-8").您如何将IRI纳入Facebook?您正在使用的接口正在发送UTF-8,但是期望使用ISO-8859-1,或者只是Facebook上的一个普通老错误.无论哪种方式,您现在都必须使用URI版本.

%c3%98%c2%b4... is what you get when you take bytes that are UTF-8 encoded and treat them as if they were ISO-8859-1-encoded (and then UTF-8-URL-encoding them again, giving a broken "double UTF-8"). How are you getting the IRI into Facebook? Either there's an interface you're using that you're sending UTF-8 but which expects ISO-8859-1, or it's just a plain old bug on Facebook's part. Either way, you'll have to use the URI version for now.

这篇关于非英语使用者的Facebook分享问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆