PHP echo using for Zen Cart 1.3.7 Contact Us coding change

Hi all,

I had a big problems while my customers using the "Contact Us" form to send the questions to us include Chinese, Japanese or Koren Text.

Since Zen Cart 1.3.7 are encode by ISO 8859-1, not using UTF-8 and the MySQL Database Collection are using latin_swfish_1, also not UTF-8

So change the header to UTF-8 total maybe will broke the all site.

So now I reading the "Contact Us"'s PHP code, find it control by this file

and I find by Google, have a tag called accept-charset="UTF-8" for the form tag ...

So I want to make a try, but I am not a programmer, try add this tag to the original PHP code failed

The Original Code here
<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send')); ?>

and it will display this XHTML output

<form name="contact_us" action="" method="post">

How to make the change to the PHP code that can add the accept-charset="UTF-8", then the XHTML output to be like that

<form name="contact_us" action="" method="post" accept-charset="UTF-8">

Thank you very much.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Richard QuadlingSenior Software DeveloperCommented:
From my understanding, you cannot cram the Japanese/Chinese/etc, characters into a codepage.

So, you would have to take the binary string of data received (using the current encoding) and convert it to a base36 string. This should be easily reversible to show back to the user.

In terms of modifying the <form> tag, you can either modify the function or use a simple string function to add the accept-charset attribute.

$s_Form = zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send'));
$s_Form = '<form accept-charset="UTF-8"' . substr($s_Form, 5);

Open in new window

Richard QuadlingSenior Software DeveloperCommented:
Having just looked at the code for zen_draw_form, you could modify the template too ...
<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', 'accept-charset="UTF-8"'); ?>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.