Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/75669-ascii-characters/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-382913
Share on other sites

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"  :(

Link to comment
https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-382971
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/75669-ascii-characters/#findComment-383045
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.