Jump to content

Prestashop 1.7 Greek encoding (Translations)


wierdthing

Recommended Posts

Greek text when added in translations from back office has an encoding problem. Every other place you put Greek letters works fine, cms pages and the lot. The problem manifests when you try to translate, Greek letters get saved in wrong format in the database and also show in wrong format in the front-end, in the back office translations page they show correctly thought

 

 

Images:

 

Front-end: http://prntscr.com/f8fbqj

Back-end: http://prntscr.com/f8fbvl

Database: http://prntscr.com/f8fc18

 

Any help will be much appreciated. Thanks in advance.

  • Like 1
Link to comment
Share on other sites

I will bump this topic since the same problem exist for Russian language as well.

In back-end everything's fine - stored translations shown correctly, but in front-end it is not.

But for me personally I can't find where translations are stored, so I can only tell that my tables are in utf8_general_ci encoding.

 

To put it shortly, everything (e.g. categories, products, pages) displayed normally except altered translations after edit/store.

 

I can provide my screenshots too.

If nobody reply I will start my own bug topic.

Edited by Serge Goujon (see edit history)
  • Like 1
Link to comment
Share on other sites

Found the file that stores the translations finally, atleast its a decent workaround until they fix the bug.

File is in app/cache/prod/translations, its a .php file.

 

Just find it and change whatever translations you want from there and it will work

  • Like 1
Link to comment
Share on other sites

Welp, as it turns out file and folder got deleted,probably because it was cache, so every change i made to it is reverted now

Edit: try app/Resources/translations/

 

Edit 2: Change what ever translations you want from there and then clear the cache, this seems to be working for me for now.

Edited by wierdthing (see edit history)
  • Like 1
Link to comment
Share on other sites

Thanks a lot, weirdthing! That's great, it's working. At least for quick & dirty fix.

 

Anyway I hope that devs will fix that officially.

 

P.S. I will post the issue later on GitHub. It's not the fastest way to let devs know things, but definitely the most efficient one!

 

Update: Going to start the ticket on Forge. 

Edited by Serge Goujon (see edit history)
  • Like 1
Link to comment
Share on other sites

Well, it appears that problem is bigger than I suppose. After I tried it with non cached files - it doesn't work for me.

 

I found the file I need to edit in app/Resources/translations/ru-RU but editing it done nothing. Encoding is still wrong. BTW there are two files wit the same content: 1.7ShopThemeCheckout.ru-RU.xlf and ShopThemeCheckout.ru-RU.xlf. Of course I edited both, cleared cache but nothing changed. Funny thing is that in *.xlf files all the text is in CORRECT encoding. Any ideas what am I missing?..

 

P.S. My guess is that the problem occurs somewhere on the way of XLF->PHP cache file conversion. But I have no idea where to look.

Edited by Serge Goujon (see edit history)
Link to comment
Share on other sites

  • 1 year later...

I can't believe that a year later no one from the dev's actually solved this  !!!! Someone forgot to add SET NAMES routine to DB driver ;) So the resolution is very simple:

in classes/db/DbPDO.php after line 121 add:

        // UTF-8 support
        if ($this->link->exec('SET NAMES \'utf8\'') === false) {
			throw new PrestaShopException('PrestaShop Fatal error: no utf-8 support. Please check your server configuration.'.$e->getMessage());
        }

ATENTION!!! ATENTION!!! ATENTION!!!

If you have working site and the data stored in your db tables looks like:

Минимальная сумма заказа

This fix will break your site resulting the same characters to be displayed site wide and all texts coming from the database to look like this! To solve this, is simple but time consuming. The simplest solution is to export your database and table by table to decode it. This  online tool is quite useful for this 2cyr.com.

If you have new installation edit the above file adding the mentioned code before adding anything to the database!

Edited by Serios (see edit history)
Link to comment
Share on other sites

Hey, Serios. You can't imagine how surprised I am! )) Thanks for your time and efforts and a way to solve the issue. Since nobody have answered to me (yeah, for almost 1 year)  and ticket is still active yet with no changes from devs, I switched to another framework. Where people do care about their users. But I'm longtime prestashop developer, so I will give it a shot for once more, on a fresh install. In case it works I will consider the future of prestashop in my projects.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...