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:
Created a duplicate PostToWall where the only thing we changed was Encoding.ASCII.GetBytes(endpoint) to Encoding.UTF8.GetBytes(endpoint).
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".
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.
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:
Would be great if this could be fixed in the plugin itself for future updates.