EPiServer Social with non-ASCII characters?

Vote:
 

Hi.

We are testing the Social Reach plugin for a customer and overall it is a really nice little plugin! Other than using the GUI provided we have even been able to programmatically utilize it for other functions in the site (for automatic publish), neat.

The problem though is that this site is in Swedish and thus has non-ASCII characters (like åäö). When posting to facebook (the only channel we use right now) those characters are read as "?".

The facebook API does support UTF-8 (and this EPi is configured to use just that). The "faulty" code is when the url is encoded:

byte[] bytes = Encoding.ASCII.GetBytes(endpoint);

Which can be found in the method Post() in the class EPiServer.Social.Providers.PostToWall.

There might be a reason that ASCII encoding is used, I don't know. But changing it to Encoding.UTF8.GetBytes(endpoint) fixes our issue, one could argue that HttpUtility.UrlEncode(endpoint) should be used prior to getting the bytes (which would make ASCII work).

The solution/quickfix we made for this is:

  1. Created a duplicate PostToWall where the only thing we changed was Encoding.ASCII.GetBytes(endpoint) to Encoding.UTF8.GetBytes(endpoint).
  2. Made a new provider for Facebook (CustomFacebookProvider) which inherits EPiServer.Social.Providers.FacebookProvider and overrides the Send(SocialMessageDto socialMessage) method. The only thing changed from the original Send-method is to use our duplicate PostToWall. Thus using the original FacebookProvider for "everything else".
  3. Changed the config for facebook to use our custom provider.

Would be great if this could be fixed in the plugin itself for future updates.

#71788
May 29, 2013 10:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.