You are here:  » Character encoding problem.

Support Forum



Character encoding problem.

Submitted by Lez on Sun, 2013-07-28 08:02 in

Hi David,

I have some character encoding problem. I use the Hungarian language, which is ISO 8859-2 Latin-2.
I use the "Global Filter" in the pt admin to Product Name, Product Description and Category (UTF8 Decode) which helped a lot, but there is still some bad characters.
Example: kivitelezésű -> kivitelezés?, függően -> függ?en
Can you help me?

Lez

Submitted by support on Sun, 2013-07-28 09:25

Hello Lez,

What normally resolves character encoding issues between the Price Tapestry database and WordPress is to ensure that the `pt_products` table character set and collation match that required, and then also to set the character encoding of the database connection.

Firstly, to make sure that the `pt_products` table is correct, create the following dbmod.php script in your Price Tapestry installation directory and then browse to the file e.g. www.yoursite.com/pt/dbmod.php

<?php
  set_time_limit
(0);
  require(
"includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            CONVERT TO CHARACTER SET latin2 COLLATE latin2_general_ci"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

Next, apply the Forward Compatibility patch for 13/03A to upgrade to the MySQLi library functions which seem to resolve a number of character encoding issues - but before uploading, modify the new includes/database.php and look for the following code at line 16:

$database_link = @mysqli_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword,$config_databaseName);

...and REPLACE with:

$database_link = @mysqli_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword,$config_databaseName);
mysqli_set_charset ($database_link,"latin2");

Finally, re-import any affected feeds (you may want to remove any filters in place as they should not be required any more) and that should do the trick!

For your convenience, I will forward to you a single .zip containing the above dbmod.php and the modified forward compatibility patch for you to upload in one go...

Cheers,
David.
--
PriceTapestry.com

Submitted by Lez on Sun, 2013-07-28 10:24

Hi David,

Thanks for the quick response.
After making the changes the situation became a little worse. :(

The import does not work. This error message is displayed:
"Warning: mysql_insert_id (): Supplied argument is not a valid MySQL-Link resource in /home/xxx/public_html/xxx/pt/includes/database.php on line 57"

The characters are even more errors:
"Alkalmaz??si javaslat: K??ls??leg: h?­g?­tatlanul ecsetelve, h?­g?­tva bed??rzs??l??k??nt alkalmazza b??rirrit??ci??k, pattan??sok, v??g??sok,"

Other ideas?

Lez

Submitted by support on Sun, 2013-07-28 13:28

Hi Lez,

I've followed up by email, any problems still if you could reply to that email that will be the fastest way to get you up and running as I'll be able to include dbmod files as requred to ensure identical settings between WP and Price Tapestry tables...

Cheers,
David.
--
PriceTapestry.com