How to create FB likebox with special URL characters - facebook

I'm trying to create a like for box my clients FB page:
https://www.facebook.com/pages/Cateringinventardk-alt-til-dit-storkøkken-og-café
I guess that little ø or é is messing it up, I got this error:
*The href parameter must reference a valid Facebook page, but "https://www.facebook.com/pages/Cateringinventardk-alt-til-dit-storkøkken-og-café" is not a valid Facebook page.
Anyone who know how I can prevent that with special url/code?
Thanks in advance!
Jan Joergensen

You could try and specify a url-encoded value for the URL. For the URL you supplied this would be something like this:
https%3A%2F%2Fwww.facebook.com%2Fpages%2FCateringinventardk-alt-til-dit-stork%C3%B8kken-og-caf%C3%A9
I've always used this tool, but any other url-encoding tool should do the same job. You might not need to encode the entire URL but rather only the "problematic" characters. For you that's everything after /pages/.
Cateringinventardk-alt-til-dit-storkøkken-og-café
Would become
Cateringinventardk-alt-til-dit-stork%C3%B8kken-og-caf%C3%A9
^----^ ^----^
encoded ø encoded é

I had to use the full url, not just the page vanity url

Related

Facebook open graph og:image escape whitespace characters

I have a page with user submitted photo galleries. I'm using the facebook API to share the photos. It shares the page with a query string. When the query string is present, it sets all the open graph properties on the page . This works great except when the image has white space characters on the file name.
I have tried replacing the whitespace characters with '%20' as so
http://example.com/gallery/images/large/this image.jpg
to
http://example.com/gallery/images/large/this%20image.jpg
But the facebook parser doesn't like that either.
Is there a way to scape these characters or am I going to have to go back and change it so that it replaces when the images get uploaded?
Answering your question (being it old), Now (in June-2017) Facebook parser works with whitespace characters when escaped with '%20', hope it would help someone looking for solution.
So, convert whitespace to %20 as depicted below:
http://example.com/gallery/images/large/this image.jpg
to
http://example.com/gallery/images/large/this%20image.jpg
Server side language has pre-defined function for that e.g. rawurlencode in PHP.
I don't think so. The facebook parser doesn't take whitespaces into account. Even if you use a redirect you will have issues later on. So it's better to just adjust your URLs now.

Facebook Feed Dialog API how to include a redirect_uri containing a #?

How can I specify a redirect_uri containing a #?
Facebook Feed Dialog API parameters reference
redirect_uri - The URL to redirect to after a person clicks a button
on the dialog. Required when using URL redirection.
This works as expected when the redirect_uri in question is a regular URL, however, when it contains a # it stops working.
When redirect_uri is http://website.com/foo, it redirects to:
https://website.com/foo?post_id=100006935442054_1384656491776519#_=_
Not sure what the trailing #_=_ is for, but it does not cause any issues here.
When redirect_uri is http://website.com/#foo, it redirects to:
https://website.com/?post_id=100006935442054_1384656491776629#_=_
Thus it appear that either the parameters after the # are ignored, or overridden with #_=_
Given that I am working with a single page application, whose routes are driven by the hash fragment, this breaks my ability to deep link within my application.
Any help/ suggestions on how to work around this would be much appreciated!
In your application you can handle query strings as if it was a hash tag, or simply do a redirect.
For example, if your route is http://website.com/#foo, make http://website.com/?hash=foo do the same thing or redirect ?hash=foo to #foo
I'm working on a problem like this right now. The URL to go in redirect_uri and link:
.../xfile.jsp?item=/contests/bhg_homeimprovement/bhg_splashsweeps_win2500_homeimprovement&temp=yes&hid=#HashID#&esrc=nwbhgsweeps072514a
The FB dialog gets an error as is. Encoding the full URL fixes that and does output hashes around "HashID", but the equal sign before it is removed. Adding a 2nd equal sign there will output 2 equal signs, but having just one will output none.
This isn't a complete solution but it does look like hash marks are possible.

How to retrieve page with special characters in page name

Trying to retrieve general page info using the Facebook graph API using an Jquery/Ajax call. This works flawlessly until I request a page containing special characters or dashes in it's name.
It seems like the special characters are ANSI encoded during the ajax request so the name is malformed and the page cannot be found. I can't find a way though to obviate this.
Example url: https://graph.facebook.com/Musée-de-la-Photographie-Charleroi?access_token=[my_access_token]
Can anybody help me out?
I think you should test different values in contentType parameter. It allows to set char encoding.
Take a look here:
http://api.jquery.com/jQuery.ajax/
It seems like the special characters are ANSI encoded during the ajax request so the name is malformed and the page cannot be found.
No, I don’t think that’s the problem.
As you can see from https://developers.facebook.com/tools/explorer?method=GET&path=18521449287, this page does not have a username set yet – and since it is not accessible via just www.facebook.com/Musée-de-la-Photographie-Charleroi, but only via www.facebook.com/pages/Musée-de-la-Photographie-Charleroi/18521449287 including the page id.
And accordingly, info about the page on the Graph API is only available via the page id as well.
Try using the page_id instead (in this case 131141113604635).
https://graph.facebook.com/131141113604635?access_token=[my_access_token]
You may get this id by opening the page on the browser and pressing Ctrl+U, Ctrl+F and searching for a 'page_id' value.

Strangely encoded url

Background:
I have been troubled by the following problem for the last week.
Normally webpages encrypt urls using base64, so that http://stackoverflow.com becomes aHR0cDovL3N0YWNrb3ZlcmZsb3cuY29t and it's used like this:
http://www.mysite.com/redir.php?url=aHR0cDovL3N0YWNrb3ZlcmZsb3cuY29t
Problem:
There are pages that use a different encryption of urls I can't crack. They all start with o5o4m4p4b434s2q43626z3 and I assume that's for http://www. comparing different links of this kind.
The urls are like this: http://www.site.com/z.php?url=o5o4m4p4b434s2q43626z3... and they all redirect to an other site.
Research:
I have googled for different ways to encrypt/decrypt urls and text, and data and nothing.
I also googled for "o5o4m4p4b434s2q43626z3" and I got no results. Am I the only one asking how they encode it? =)
Any ideas? How does "http://www." become "o5o4m4p4b434s2q43626z3" ?
Cheers and good hunting!
It sounds like some type of ID that is generated for that URL. Most likely there is a relationship in some type of database that stores both the URL and the code there. When redir.php is loaded, the string inside the url query string is looked up in the database and the user is redirected.

Facebook Share problem for Non English Urls

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
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
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/story/75
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
http://www.website.com/ar/شاهدى-عروض-الأزياء-العالمية-بعيون-عربية/موضة/story/75
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!).
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... 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.