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
/includes/templates/template_default/templates/tpl_contact_us_default.php

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="http://www.rctoplist.com/testegrm/contact_us.html?action=send" 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="http://www.rctoplist.com/testegrm/contact_us.html?action=send" method="post" accept-charset="UTF-8">

Thank you very much.
questions1979Asked:
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.


<?php
$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

0
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

0

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
PHP

From novice to tech pro — start learning today.