Fix for this plugin messing up non-Western languages
-
So I contacted the WP RSS a few weeks ago about a problem I had seen for a while using their plugin (I am a paid user of their product addons). The problem exists on EVERYONE’s installation of the plugin but only affects you if you aggregate non-Western charsets into your WordPress site. Fixing it doesn’t seem like a top priority for WP RSS, so I had to fix it myself and share with you the solution.
The problem is that the plugin takes all post-content and makes it into ASCII text. This of course doesn’t affect you if you use English, because ASCII English and UTF-8 English are the same. But it does affect you if you use maybe gb2312 or big5 or Korean or Thai or a Sanskrit-based language, etc. It affects you negatively because the WP RSS plugin *INCORRECTLY* changes the UTF-8 content from the original source into ASCII. And then within your MySQL in the post-content field it saves it all as ASCII test.
When WordPress then calls that field and displays it, most likely it will display fine on the frontend, because most modern browsers know how to translate ASCII into human-readbale text. So WP RSS may aggregate Chinese from an original source, save it as ASCII, and then display within a browser as normal Chinese again. But that is all cosmetic and the backend is still broken.
But there is a problem… because the database itself saves the content as ASCII, most functions that trim or try to read that post content will not be able to do anything. So, for example, if you try to trim the excerpt length with a function to 10 characters, the function won’t be able to understand what a “character” looks like because it’s all in ASCII.
So the fix is actually quite simple within WP RSS. I looked at the code and I can see where the changes can easily be made to make this a plugin that can used globally rather than just in Europe and North America (maybe I should make a fork). But instead of changing the plugin, I just made this function:
function wprss_ftp_dumb_converter_post_content_callback( $string, $arg1 ) { $string=html_entity_decode($string, ENT_QUOTES, 'UTF-8'); return $string; } add_filter( 'wprss_ftp_dumb_converter_post_content', 'wprss_ftp_dumb_converter_post_content_callback', 10, 3 );
So that should fix the problem for you. I hope WP RSS developers c an integrate this fix into the plugin itself though.
- The topic ‘Fix for this plugin messing up non-Western languages’ is closed to new replies.