Hi everyone,
I am using fopen and fwrite to generate an XML file to be used by a Word template to fill certain fields. However, the created file is not recognised by Word due to encoding problems. I don't know how to save the file in an XML format recognised by Word template?

Thanks in advance

    Thanks for your reply. But did you mean PHP headings? Because the article doesn't say anything about PHP.

      When I manually create the XML file, the Word template uses it with no problem, but when it is automatically generated by PHP the Word template does not recognise it!

        i guess he obvious question is what's the difference between the manually and automatically generated files?

          John Marbon;10956856 wrote:

          Well, if you wish. 🙂

          not really, you are the one asking for help.😕

            as i asked befor:

            what's the difference between the manually and automatically generated files?

              They are the same, in the content-wise at least. However, the manually created file is recognised by the Word template and can read from it, while the file generated by PHP is not recognised and generates errors when read by the template.

                if they were identical there would be no issue, ergo, they are not. if you can't visually see any difference download a file comparison tool, may be worth doing a binary compare also.

                  if they are small, post them both as attachments.

                    <?xml version='1.0' encoding='windows-1256'?>
                    <root>
                    <Item>Bed</Item>
                    <Price>1200</Price>
                    <Amount>23</Amount>
                    </root>

                      attachments then the encoding wont be altered, and there should be 2

                        I think the generated file is saved in ANSI even though it has its header is <?xml version='1.0' encoding='windows-1256'?>. Do you have any idea how to generate it as windows-1256?

                          windows-1256 is for arabic

                            Write a Reply...