You are here:  » problem encoding with fetch.sh

Support Forum



problem encoding with fetch.sh

Submitted by affolable on Fri, 2010-11-19 07:34 in

Hi,

I have a problem with the import when I made an import from the admin all is OK, but if I use in the console "/usr/local/bin/php import.php" I have a problem with the encoding

I try to add a filter with utf8_encode at this time all is OK with the console and not ok in the admin

Thanks for you help

Jean-Christophe

Submitted by support on Fri, 2010-11-19 09:28

Hello Jean,

PHP can sometimes be configured such that it doesn't internally change directory to the same folder as the script be executed; which will stop import.php from working as needs to know how to locate the feeds directory. In your fetch.sh script, in place of, for example;

/usr/bin/php /home/username/public_html/scripts/import.php @ALL

instead use:

cd /home/username/public_html/scripts/
/usr/bin/php import.php @ALL

This shouldn't however have any effect on character encoding so if that's still a problem let me know and I'll look into it further...

Cheers,
David.
--
PriceTapestry.com

Submitted by affolable on Fri, 2010-11-19 16:23

Hi David,

in my fetch.sh I already use :

cd /home/username/public_html/scripts/
/usr/bin/php import.php @ALL

I'm trying to find a way to change the encoding only for the file in the fetch.sh but I dind't find now

Thx
Jean-Christophe

Submitted by support on Fri, 2010-11-19 16:30

Hello Jean-Christophe,

Just to make sure I understand, do you mean that you added a UTF8 Encode filter in /admin/, and when you import from /admin/ it is OK, but when your fetch.sh script does the import the filter does not work?

Thanks

Cheers,
David.
--
PriceTapestry.com

Submitted by affolable on Fri, 2010-11-19 16:44

Hi David,

yes you understand ;)

Now I find a solution, in fetch.sh I put

cd /home/username/public_html/feeds
iconv -f iso-8859-1 -t utf-8 motoshop0.xml > motoshop.xml

cd /home/username/public_html/scripts/
/usr/bin/php import.php @ALL

cd /home/username/public_html/feeds
mv motoshop0.xml motoshop.xml

Thx for your help
JC