raja9911 Posted November 1, 2007 Share Posted November 1, 2007 Hey i have made this e-business software with php and smarty, but i have a kind of a major problem Whenever the code read charecters like " ' æ ø å " etc (commen letters in the danish language) from the database it just make it as a quastion mark (?) on the screen Is there a function to solve this problem. How would u experts suggest i should fix this problem Thanks in advance Raja Quote Link to comment https://forums.phpfreaks.com/topic/75669-ascii-characters/ Share on other sites More sharing options...
effigy Posted November 1, 2007 Share Posted November 1, 2007 What character set is the database in? I recommend using UTF-8. Quote Link to comment https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-382911 Share on other sites More sharing options...
raja9911 Posted November 1, 2007 Author Share Posted November 1, 2007 it is UTF-8 Unicode ... i mean in the database u can see the correct characters. But when the phpcode reads from it, it gets messed up... when i enter the product in database and write the correct acsii code... it shows the character perfect :-\ Do you think there is something wrong with my code then which i need to locate Quote Link to comment https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-382913 Share on other sites More sharing options...
effigy Posted November 1, 2007 Share Posted November 1, 2007 Does the database know you want UTF-8? See this post. Quote Link to comment https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-382924 Share on other sites More sharing options...
raja9911 Posted November 1, 2007 Author Share Posted November 1, 2007 I think this is the solution. Im just very confused cuz i use smarty. I use the commands $this->db = DB::connect($connectionString, USE_PERSISTENT_CONNECTIONS); $this->db->setFetchMode(DB_FETCHMODE_ASSOC); and then $result = $this->db->query($queryString); I got no idea how to put "SET CHARACTER SET utf8" Quote Link to comment https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-382971 Share on other sites More sharing options...
thebadbad Posted November 1, 2007 Share Posted November 1, 2007 If your database is UTF-8, then the page showing data off the database should be encoded in UTF-8 too. Be sure to use <meta http-equiv="content-type" content="text/html; charset=utf-8" /> in your (X)HTML (between the head tags). If you knew all this, PHP's utf8_encode/utf8_decode could do the trick, but I'm not sure that's the best solution. Quote Link to comment https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-383045 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.