If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Scandinavian characters not being saved on product description

Scandinavian characters not being saved on product description

Started by arsi on 9 Feb 2014, 1:01 PM · Views: 862

Results 1 to 5 of 5
9 Feb 2014, 1:01 PM
#1
arsi avatar

arsi

New Zenner

Join Date:
Jan 2012
Posts:
5
Plugin Contributions:
0

Post #1 by arsi

I have a weird bug at the moment. Nothing is being saved through admin interface when updating product descriptions if you use a Scandinavian characters. Same seems to go for customer comments on order page. If you do not use Scandinavian characters (öäå, ÖÄÅ) then everything gets saved properly. There might be other pages that are affected by this too, just haven't found those yet. This has worked for more than two years now and no changes have been made to Zen Cart site for months. I don't know if the hosted server is updated or changes made to it. Could some update on hosted server side affect Zen Cart site?

It probably has something to do with character set. Strange thing is that you can use Scandinavian characters on category description but not on the product description. If I edit the database directly with phpMyAdmin, it works as assumed. Scandinavian characters are saved and displayed correctly on the site and admin interface.

Aah, just tested updating product description using English language on admin site. Text is being saved but the Scandinavian characters are being "scrambled". Is there some mismatch in encoding between database and site charset? Any help would be appreciated!

../admin/includes/languages/finnish.php
// charset for web pages and emails
define('CHARSET', 'iso-8859-1');

../admin/includes/languages/english.php
// charset for web pages and emails
define('CHARSET', 'utf-8');

Zen Cart 1.5.0

-Arsi

9 Feb 2014, 2:49 PM
#2
lat9 avatar

lat9

Administrator

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

Post #2 by lat9

What collation is being used by your database? Use your web-host's phpMyAdmin to view the structure of various tables. The collation's name will be latin1_<something> if the database is using ISO encoding and utf8_<something> if it's using a form of utf8.

Then check your /includes/configure.php and /YOUR_ADMIN/includes/configure.php files to see what your DB_CHARSET value is (it should match the collation value, either latin1 or utf8) that your database is using.

Then, based on whether the database is latin1/utf8, you should set each of the language-display CHARSET values to match (an iso- flavor for a latin1 database and a utf8 flavor for a utf8 database).

9 Feb 2014, 3:55 PM
#3
arsi avatar

arsi

New Zenner

Join Date:
Jan 2012
Posts:
5
Plugin Contributions:
0

Post #3 by arsi

@lat9

Tables are all utf8_general_ci

/YOUR_ADMIN/includes/configure.php
define('DB_CHARSET', 'latin1');

Thanks, I can now save descriptions with Scandinavian characters. Unfortunately it breaks my localized templates Scandinavian characters. I wonder why or how it has been working for this long...?

Could I just convert my 'products_description' table to latin1_swedish_ci? Or the whole database? What could be the best way to fix this issue?

http://stackoverflow.com/questions/17049903/converting-mysql-table-with-incorrectly-encoded-data-to-utf-8

9 Feb 2014, 4:26 PM
#4
lat9 avatar

lat9

Administrator

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

Post #4 by lat9

Arsi:

@lat9

Tables are all utf8_general_ci

/YOUR_ADMIN/includes/configure.php
define('DB_CHARSET', 'latin1');

Thanks, I can now save descriptions with Scandinavian characters. Unfortunately it breaks my localized templates Scandinavian characters. I wonder why or how it has been working for this long...?

Could I just convert my 'products_description' table to latin1_swedish_ci? Or the whole database? What could be the best way to fix this issue?

http://stackoverflow.com/questions/17049903/converting-mysql-table-with-incorrectly-encoded-data-to-utf-8
Because your finnish-language files are using an ISO encoding, the show garbledefunk when displayed using utf8. I'm unaware of an "easy" ISO->UTF8 changing method, but you'll eventually want to make sure that each of your finnish language files are encoded using "UTF8 without BOM" (an easy setting to change in the Notepad++ editor) and update each of the 'funky' character-pairs with their UTF8 equivalent.

9 Feb 2014, 6:53 PM
#5
arsi avatar

arsi

New Zenner

Join Date:
Jan 2012
Posts:
5
Plugin Contributions:
0

Post #5 by arsi

@lat9

I need to evaluate how to do it. Thanks again for your help!