when site uses utf-8 encoding, yml though must be in win 1251.
now .yml file has in header with unrecoverable wrong converted russian characters in .yml body:

<category id="25" parentid="&gt;22">��������� MOSAIC</category>
<category id="16" parentid="&gt;0">����������������� ����� � ����</category>

by replace

echo yml_convert_to_1251(theme('yml_products', $nodes, $categories), 'utf-8');

in line 127 of yml_export.module with

echo theme('yml_products', $nodes, $categories)

you can obtain correct and unusefull utf-8 encoded file, instead of win-1251

CommentFileSizeAuthor
#6 err1yml.jpg24.5 KBcom_net

Comments

com_net’s picture

sorry, should read:
...yml file has utf-8 charset in header...

restyler’s picture

The yml files generated with Yandex export are perfectly valid for Yandex.market.
The module uses win1251 because of historical reasons (Yandex market didn't like utf8 files during validation process - now that's fixed on their side).
When I have more time, I will remove win1251 encoding from the module as it's not neccessary anymore.

com_net’s picture

1251 is the only encoding acceptable by Yandex market.
Yandex market does not work with utf-8.
YML file generated by module is NOT in win 1251 - it is in utf-8 (site default) with wrong header.
The first string of yml_products.tpl.php should be
<?php header('Content-type: application/xhtml+xml; charset=windows-1251');?>
instead of
<?php echo "<?xml version=\"1.0\" encoding=\"windows-1251\"?>\n" ?>

restyler’s picture

1251 is the only encoding acceptable by Yandex market.
Yandex market does not work with utf-8.

That is not true - I've just changed the module to work with utf-8, here is the yandex.market file check result: http://pix.am/krg0.png
it looks like utf8 is fine for market now.
Please check the latest .dev of the module (that will be generated in several hours) on your shop to see if you get any problems with new utf8 approach.

YML file generated by module is NOT in win 1251 - it is in utf-8 (site default) with wrong header.

that is not true, either. the module encodes its output to win1251. (to be more correct, it encoded until now - I've just removed all the utf8->win1251 encoding logic from the module, we're pure utf8 now!). Yes, there were some problems with headers, though - which caused the problem with user browsers, opening the generated .xml, but not with yandex market parsing robot.

The first string of yml_products.tpl.php should be
header('Content-type: application/xhtml+xml; charset=windows-1251');
instead of
echo "<?xml version=\"1.0\" encoding=\"windows-1251\"\n" ?>

I think you are have problems understanding what is the difference between header() and echo "<?xml" strings that you've mentioned above. That is completely different things, we can't put one thing _instead_ of other. I've added header() call to specify correct content type and encoding now, though - thanks.

restyler’s picture

Status: Active » Fixed
com_net’s picture

StatusFileSize
new24.5 KB

if you have both header and xml type declaration in yml_products.tpl.php - you will get an error "duplicate XML declaration" on preview yml_products.xml

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.