0

Hi everyone!
So far I managed to make the shopping cart to work with utf characters, but I came across another problem.
When I add a new product from the admin, it puts the data into the database. But the cyrillic characters are shown like ?????????.
When I change the name and the description of the product straight into the database (from phpMyAdmin), the cyrillic characters are shown without a problem.
So basically the problem is that it puts the data into the database not like utf-8 but like latin or something.
The collation of the database is utf8_unicode_ci.
The code with the functions is this:

<?php
header ('Content-type: text/html; charset=utf-8');
require_once 'utf.php';
require_once '../../library/config.php';
require_once '../library/functions.php';

checkUser();

$action = isset($_GET['action']) ? $_GET['action'] : '';

switch ($action) {
	
	case 'addProduct' :
		addProduct();
		break;
		
	case 'modifyProduct' :
		modifyProduct();
		break;
		
	case 'deleteProduct' :
		deleteProduct();
		break;
	
	case 'deleteImage' :
		deleteImage();
		break;
    

	default :
	    // if action is not defined or unknown
		// move to main product page
		header('Location: index.php');
}


function addProduct()
{
    $catId       = $_POST['cboCategory'];
    $name        = $_POST['txtName'];
	$description = $_POST['mtxDescription'];
	$price       = str_replace(',', '', (double)$_POST['txtPrice']);
	$qty         = (int)$_POST['txtQty'];
	
	$images = uploadProductImage('fleImage', SRV_ROOT . 'images/product/');

	$mainImage = $images['image'];
	$thumbnail = $images['thumbnail'];
	
	$sql   = "INSERT INTO tbl_product (cat_id, pd_name, pd_description, pd_price, pd_qty, pd_image, pd_thumbnail, pd_date)
	          VALUES ('$catId', '$name', '$description', $price, $qty, '$mainImage', '$thumbnail', NOW())";

	$result = dbQuery($sql);
	
	header("Location: index.php?catId=$catId");	
}


?>

Can someone help me with this?
Thank you in advance!!!

Edited by didi00: n/a

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by didi00
0

Oops... sorry I fixed it.
All I needed to do is to open the files into notepad and to save them again like UTF-8.
Guess sometimes the simplest things are a solution to the problem.:-)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.