Ayon Posted March 16, 2009 Share Posted March 16, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/ Share on other sites More sharing options...
Ayon Posted March 16, 2009 Author Share Posted March 16, 2009 one thing i forgot to add was that... when I add an entry to the base it works.. but when i try to update the entry it replaces the letters Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786129 Share on other sites More sharing options...
corbin Posted March 17, 2009 Share Posted March 17, 2009 Have you changed the collation of the MySQL connection? http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786337 Share on other sites More sharing options...
Ayon Posted March 17, 2009 Author Share Posted March 17, 2009 hmm where do I change those settings? sorry but I'm new to setting up phpmyadmin on a remote host EDIT: Nvm, found it...but I allready had that set to utf8_general_ci Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786529 Share on other sites More sharing options...
Ayon Posted March 17, 2009 Author Share Posted March 17, 2009 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... Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786544 Share on other sites More sharing options...
fenway Posted March 17, 2009 Share Posted March 17, 2009 What's "it" in this case... there's a php side to this issue as well. Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786670 Share on other sites More sharing options...
Ayon Posted March 17, 2009 Author Share Posted March 17, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786908 Share on other sites More sharing options...
fenway Posted March 17, 2009 Share Posted March 17, 2009 Where the SET NAMES from php? Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-786998 Share on other sites More sharing options...
Ayon Posted March 17, 2009 Author Share Posted March 17, 2009 hmmm do you mean the query? if so yes.. that's returned by echo $sql Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-787023 Share on other sites More sharing options...
Ayon Posted March 18, 2009 Author Share Posted March 18, 2009 *bump* Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-787491 Share on other sites More sharing options...
fenway Posted March 19, 2009 Share Posted March 19, 2009 *bump* Solved how? Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-788271 Share on other sites More sharing options...
Ayon Posted March 19, 2009 Author Share Posted March 19, 2009 hehe it was so redicolously easy... 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 just had to change that to utf-8 and problem was solved Quote Link to comment https://forums.phpfreaks.com/topic/149708-solved-my-base-keeps-changing-some-chars-to/#findComment-788562 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.