3
votes

I translated my plugin with poedit, and it works fine on localhost, on new fresh wordpress instalation, but when i uploaded my plugin on server, on exsisting site, some russian charachters missing. I get latin istead, i encoded poedite files with utf8, same in header i have utf8. Where colud be problem, other poedit translation for romanian works well? In fact russian words are translate, but some letters, still in latin.

Is there some adjustments in config file, or something else? Also i download another wordpress site, and try my plugin on localhost, same results some russian charachters missing. Could be problem with some wordpress settings?

So russian translation works on new fresh basic wordpress instalation, not when i install my plugin on pre - exsiting site.

2
Which plugin do you using?Helping Hands
i created my own pluginVladimir Štus
Ahh. then difficult to identify for us..Helping Hands
yes i translate it with poedit, wich using gettext lib, maybe some settings in wordpress, create error, i cant figure it outVladimir Štus

2 Answers

3
votes

Usually string for translations are not stored in the DB, so the MySQL settings are usually not an issue. But to have a correct UTF-8 encoding with translations, make sure these requirements are set:

  1. Encode your plugin PHP files in UTF-8 (whithout BOM) and not ANSI
  2. Make sure your .po file is encoded in UTF-8, just as the plugin file
  3. Check the "header" of your .po file for the correct UTF-8 setting:
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
  1. Make sure the HTTP-Response is encoded in UTF-8

If all those requirements are set, you should see correct encoded characters.

1
votes
  1. From How to Fix the Character Encoding Problem in WordPress, try commenting out the following lines:

    define('DB_CHARSET', 'utf8');
    define('DB_COLLATE','');
    
  2. Make sure some of those characters are accidentally in latin1. Explained here: WordPress and MySQL character encoding

  3. I think this post describes the same solution as 1 but still might be helpful. Seeing Weird Characters On Your Blog? Here’s How To Fix Your WordPress Character Encoding (Latin1 to UTF8)

References on the WordPress Dev StackExchange: