Jump to content

[SOLVED] My base keeps changing some chars to ?


Ayon

Recommended Posts

Hey everyone :)

I'm stuck at a really annoying problem here...

 

well basicly what happens is that it keeps changing æ ø å Æ Ø Å to ?, and that's a pretty massive problem for me cuz I'm working on a norwegian site... I've change the base to utf8_general_ci but still doesn't work :(

 

Thanks in advance

- Ayon

Link to comment
Share on other sites

Ok here's the setup after i changed all charsets...

 

Collation: utf8_unicode_ci

Table: utf8_general_ci

All text rows: utf8_general_ci

 

Now it's stopped replacing with ? but now it just removes it...

Link to comment
Share on other sites

Hey again :)

 

First I wanna say, thanks for helping me trying to solve this issue..

I've added some info I thought could be usefull... Dunno if you need all this info but.. Well here it goes :)

 

MySQL:

Server: ********** via TCP/IP

Server version: 5.0.60-log

Protocol version: 10

User: ************

MySQL charset: UTF-8 Unicode (utf8)

 

Web server

Apache

MySQL client version: 5.0.56

PHP extension: mysqli

 

Query:

UPDATE `wiifan_games` SET `game_name`='hmmm', `game_released`='1136070000', `game_releasedby`='10', `game_creator`='10', `game_info`='This sentance contains the letters æ ø å & Æ Ø Å', `game_genre`='1', `game_age`='0', `game_online`='0', `game_total_players`='1', `game_rating`='3', `game_service`='1', `game_subservice`='', `game_modified`='1237309890', `game_modified_by`='1' WHERE `game_id`='12' 

 

Query result

This sentance contains the letters

 

The handler script

<?php

session_start();
require_once('../inc/functions/db.php');
require_once('../inc/functions/misc.php');
$error = array();
$id = $_POST['gameid'];
if (empty($_POST['name'])) { $error['name'] = "Må fylles ut"; }
if (empty($_POST['releasedby'])) { $error['releasedby'] = "Må fyllesut"; }
if (empty($_POST['creator'])) { $error['creator'] = "Må fylles ut"; }
if (empty($_POST['info'])) { $error['info'] = "Må fylles ut"; }
if (empty($error)) {
	DbConnect();
	foreach ($_POST as $key => $val) { ${$key} = mysql_real_escape_string($val); }
	//echo $info;
	$released = mktime(0, 0, 0, $_POST['month'], $_POST['day'], $_POST['year']);
	$modified = time();
	$modifiedby = $_SESSION['user']['user_id'];
	/*$fixchar[0] = array('æ','ø','å','Æ','Ø','Å');
	$fixchar[1] = array('æ','ø','å','&Aelig;','Ø','Å');
	$info = str_replace($fixchar[0],$fixchar[1],$info);
	$name = str_replace($fixchar[0],$fixchar[1],$name);*/
	//echo $info;
	$sql = "UPDATE `wiifan_games` SET
			`game_name`='".$name."',
			`game_released`='".$released."',
			`game_releasedby`='".$releasedby."',
			`game_creator`='".$creator."', ";
	if (isset($cover)) { 
		$sql .= "
			`game_cover`='".$cover."', ";
	}
		$sql .= "
			`game_info`='".stripslashes(str_replace($fixchar[0],$fixchar[1],$info))."',
			`game_genre`='".$genre."',
			`game_age`='".$age."',
			`game_online`='".$online."',
			`game_total_players`='".$players."',
			`game_rating`='".$ranking."',
			`game_service`='".$service."',
			`game_subservice`='".$subservice."',
			`game_modified`='".$modified."',
			`game_modified_by`='".$modifiedby."'
			WHERE `game_id`='".$id."'
	";
	echo "$sql";
	if ($result = mysql_query($sql) or die(mysql_error())) {
		if (!empty($_FILES['cover']['name'])) {
			MiscUpload('games',$id,$_FILES['cover'],'cover',2,true);
		}
		//header("Location: ../games.php");
	}
} else {
	foreach ($error as $key => $val) {
		$_SESSION['handler']['addgame']['error'][$key] = $val;
	}
	foreach ($_POST as $key => $val) {
		if (!empty($val)) {
			$_SESSION['handler']['addgame']['content'][$key] = $val;
		}
	}
	header("Location: ../games.php?vis=edit&id=$id");
}

?>

 

Let me know if you need anything else...

 

Thanks In Advance

Link to comment
Share on other sites

hehe it was so redicolously easy... :D me and a designer are working side by side... he doing html i doing php.. and he had set charset to iso in the header :P just had to change that to utf-8 and problem was solved :P

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.