PDA

View Full Version : Product import and character encoding problem


Scandal
11-19-2017, 10:53 PM
Well, we have two boards:
- one in ISO-8859-7 (Greek) / my development board
- and another one in UTF-8

When I export a product from my dev board and import it to the UTF-8 board, there is issue with the Greek characters. :(
They appearing as "???????".

In the other hand, if I import the same product on another ISO-8859-7 board works perfect.

Any idea how to fix it?

Dave
11-19-2017, 11:41 PM
Is the encoding of the database with the question marks properly set?

Scandal
11-19-2017, 11:52 PM
hmm yes I think so, but how I can detect that it is the correct encoding?

Both boards I noticed works perfect for posting any characters (english / greek). The issue is on the product import where the greek characters inside the template saved as "?????" cause when I visited the page where a template is called, I see "?????" instead of greek chars.

Scandal
11-26-2017, 11:47 AM
Any idea? The product I'm trying to import is a bit big, I can't re-build it on the utf-8 board. :(
I need to import it so it will be working as should.

I'm using Notepad++.

In Omnibus
11-26-2017, 01:06 PM
Any idea? The product I'm trying to import is a bit big, I can't re-build it on the utf-8 board. :(
I need to import it so it will be working as should.

I'm using Notepad++.

Have you tried converting the script using iconv?

https://stackoverflow.com/questions/11316986/how-to-convert-iso8859-15-to-utf8/36619843#36619843

Scandal
11-26-2017, 01:10 PM
Well, I found a hard-coded solution. :)

1. Open the exported xml with Notepad++
2. Convert it to UTF-8 (Encoding > Encode in UTF-8 > Save)
3. Open file /includes/class_xml.php, then find:
$xml_encoding = (($in_encoding != 'UTF-8' OR strtoupper($stylevar['charset']) != 'UTF-8') ? 'ISO-8859-1' : 'UTF-8');
4. Add below:
$target_encoding = 'UTF-8';
$xml_encoding = 'UTF-8';
5. Then try to import *xml product via AdminCP.

All ok! :D

6. Undo step #4.

Done :)