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?
Richard QuadlingConnect With a Mentor Senior 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

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

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.