Site maintenance: Tuesday 17 Nov, from 10:00 UTC, about 4–6 hours. Details

This cutover relies on some testing that is still incomplete so may be cancelled at short notice

Forums / Addon Shipping Modules / CP module displaying symbols in accents

CP module displaying symbols in accents

Started by servicesinfosl on 11 Feb 2013, 12:25 PM · Views: 1,272

Results 1 to 7 of 7
11 Feb 2013, 12:25 PM
#1
servicesinfosl avatar

servicesinfosl

New Zenner

Join Date:
Feb 2012
Location:
Sherbrooke QC Canada
Posts:
8
Plugin Contributions:
0

CP module displaying symbols in accents

Good day. This might not be the right place to ask what to do, but I am not entirely sure the problem is with the module.

I am using the latest Canada Post 1.50 contribution (by Dr. byte, I believe) with my Zen Cart. When I ask delivery prices on checkout in french, I get the right rates, but have accents replaced with black "?" symbols (IE: "Colis acéléré" is displayed as "Colis ac?l?r?").

My accents DO display properly all over my site and have set "@setlocale(LC_TIME, 'fr_CA.utf8');" in my CUSTOM french.php file. This problem is happening on both my Zen Cart stores:

https://www.servicesinfosl.com
https://www.boutiqueimpasse.com

It is only the results coming back from Canada Post XML that returns what seams to be the wrong coding. Anyone have a solution / workaround and have also encountered the same problem?

11 Feb 2013, 1:01 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,139
Plugin Contributions:
56

Re: CP module displaying symbols in accents

Are you saving your custom French language files as "UTF8 without BOM"?

11 Feb 2013, 7:31 PM
#3
servicesinfosl avatar

servicesinfosl

New Zenner

Join Date:
Feb 2012
Location:
Sherbrooke QC Canada
Posts:
8
Plugin Contributions:
0

Re: CP module displaying symbols in accents

I think so. The original files were translated in house using the v1.5.0 distribution English source code. I use Crimson Editor to edit php files. Only Canada Post service description does this. I have no issues anywhere else concerning this.

12 Feb 2013, 5:04 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: CP module displaying symbols in accents

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

15 Feb 2013, 1:36 PM
#5
servicesinfosl avatar

servicesinfosl

New Zenner

Join Date:
Feb 2012
Location:
Sherbrooke QC Canada
Posts:
8
Plugin Contributions:
0

Re: CP module displaying symbols in accents

Thanks for the reply. I just checked and that mod is already in place. :-(

15 Feb 2013, 2:14 PM
#6
servicesinfosl avatar

servicesinfosl

New Zenner

Join Date:
Feb 2012
Location:
Sherbrooke QC Canada
Posts:
8
Plugin Contributions:
0

Re: CP module displaying symbols in accents

I have found the solution! Thanks to DrByte's suggestion, I actually added to the original code:

$methods = array();
      for ($i = 0; $i < sizeof($canadapostQuote); $i ++) {
        list ($type, $cost) = each($canadapostQuote[$i]);
        $type = html_entity_decode($type);
        if ($this->cp_online_handling == true) {
          if ($method == '' || $method == $type) {

And added the following:

$methods = array();
      for ($i = 0; $i < sizeof($canadapostQuote); $i ++) {
        list ($type, $cost) = each($canadapostQuote[$i]);
        $type = utf8_encode(html_entity_decode($type));
        if ($this->cp_online_handling == true) {
          if ($method == '' || $method == $type) {

This fixes permanently the problem. I guess that Canada Post XML does not return UTF-8 encoded results. This FORCES UTF-8 on the results.

Hope this fix is IMPLEMENTED in the CANADA POST module and helps others cursed with the many accent problems. Thanks DrByte!

16 Feb 2013, 8:58 PM
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: CP module displaying symbols in accents

This thread has been moved out of the Bug Reports area since it's not a bug with Zen Cart itself.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.