Zen Cart Logo
Forums / General Questions / How do I change the "Contact Us" Form encoding to UTF-8?

How do I change the "Contact Us" Form encoding to UTF-8?

Locked

Views: 5,335

Results 1 to 9 of 9
This thread is locked. New replies are disabled.
28 Jan 2008, 9:21 AM
#1
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

How do I change the "Contact Us" Form encoding to UTF-8?

Hi all,

Since my cart now discovered that some customers from other country that using non-english to input text on the "Contact Us" page.

What the e-mail that we received are changed to #454342; etc.

How to force only "Contact US" are using UTF-8 to send the e-mail out.

I know can change the html_header.php under common, but it will also make the whole web site be UTF-8 that what I don't want to, since the MySQL Database and other products that entered are using ISO-8859-1 for encoder....

and I open
\includes\templates\template_default\templates\tpl_contact_us_default.php

Find this line

<div class="centerColumn" id="contactUsDefault"> <?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send')) . 'accept-charset="UTF-8"'; ?>

It will output the HTML code on the front-end like below

<div class="centerColumn" id="contactUsDefault">

<form name="contact_us" action="http://www.rctoplist.com/testegrm/contact_us.html?action=send" method="post"> Then I try to change it by this below: <div class="centerColumn" id="contactUsDefault"> <?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send')) . 'accept-charset="UTF-8"'; ?>

But it will show the HTML code on the front-end like that not what I want ...

<div class="centerColumn" id="contactUsDefault">

<form name="contact_us" action="http://www.rctoplist.com/testegrm/contact_us.html?action=send" method="post">accept-charset="UTF-8"Like what you see, the accept-charset="UTF-8" is not in the method="post"> or behind it

How to make the PHP code to output the HTML be that right one?

<div class="centerColumn" id="contactUsDefault">

<form name="contact_us" action="http://www.rctoplist.com/testegrm/contact_us.html?action=send" method="post" accept-charset="UTF-8" > :frusty:

Thank you very much.

29 Jan 2008, 2:23 AM
#2
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

Hi all,

I had a big problems while my customers using the "Contact Us" form to send the questions to us.

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.

29 Jan 2008, 9:37 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: How do I change the "Contact Us" Form encoding to UTF-8?

explorer1979:

<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send')) . 'accept-charset="UTF-8"'; ?>

You've put the extra parameter in the wrong place.

Try this instead:```

<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', 'accept-charset="UTF-8"'); ?>
30 Jan 2008, 4:21 AM
#4
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

**I following your code add to it, it show me that@@

Error!

Unable to determine connection method on a link!

Known methods: NONSSL SSL

:frusty:
**

30 Jan 2008, 4:27 AM
#5
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

Try:

<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send'), 'post', 'accept-charset="UTF-8"'); ?>
30 Jan 2008, 4:28 AM
#6
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

The code need be that

<?php echo zen_draw_form('contact_us', zen_href_link(FILENAME_CONTACT_US, 'action=send') , 'post', 'accept-charset="UTF-8"'
); ?>
30 Jan 2008, 4:36 AM
#7
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

This way not work

Can send the e-mail

But received e-mail content like that (Based on header meta using ISO-8859-1, but if change the header meta to UTF-8, the MySQL using latin1- collection will don't know what happened! it is why I not change the header meta from ISO-8859-1 to UTF-8, just thinking the form tag or by the other side...)

ä¸##文 (Chinese)

現役初 ã‚«ãƒ¼ãƒ—æ±å‡ºãŒæ—©å¤§åˆæ ¼ (Japanese)

現役初 ã‚«ãƒ¼ãƒ—æ±å‡ºãŒæ—©å¤§åˆæ ¼ (Koren)

Before not change anything and the e-mail will send back like that (Header meta using ISO-8859-1 too)

Chinese
中文字

Anyone have experience the "Contact Us" received E-Mail that is not using English like, Japanese or etc, what is your solved on this?:(

30 Jan 2008, 6:10 AM
#8
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

Hi, after I try this way

Add the code to it

<?php header('content-type: text/html; charset: utf-8'); ?>

Then the front-page show this

Warning: Cannot modify header information - headers already sent by (output started at /home/hpcd/public_html/hpcd/includes/templates/ZC03C00093/common/html_header.php:22) in /home/hpcd/public_html/hpcd/includes/templates/template_default/templates/tpl_contact_us_default.php on line 16

I know the header is loaded first, but do it have a way to force add a coding like that to replaced loaded header's content from ISO-8859-1 to UTF-8?

Thank

30 Jan 2008, 6:37 AM
#9
explorer1979 avatar

explorer1979

Inactive

Join Date:
Jan 2007
Posts:
377
Plugin Contributions:
0

Re: How do I change the "Contact Us" Form encoding to UTF-8?

For example

The
define('CHARSET','iso-8859-1');

How to re define the
CHARSET to utf-8 after it loaded the value.