Jump to content

Recommended Posts

Hi everyone,

I'm a member of a couple of web design forums, but now that I'm dealing with PHP regularly I've decided to join this dedicated php forum.

 

The site I'm working on isn't displaying Polish characters correctly. The site draws its content from MySQL. It's bilingual and uses seperate tables for English and Polish content.

 

The whole database's collation is utf8_general_ci and I've put the following in the page <head>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

 

The file was saved as UTF8 (without BOM) yet polish characters are not displayed correctly.

Should I be using BOM?

 

The polish text was entered straight into phpmyadmin.

 

I have tried using

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />

This causes some polish characters to be displayed, but not all of them.

 

I've also tried changing the database collation.

I can provide the URL and source if needed.

 

Any help would be greatly appreciated!

Bede

 

 

Hi bedeabc,

 

Also, if you're outputting the data via another PHP function (such as html_enttities_decode or similar) you need to specifiy an encoding type to the function.

 

If you post your code we could give a more definite answer.

After you connect to the database run the following query

mysql_query("SET NAMES 'UTF-8'");

 

along with

 

mysql_query("SET CHARACTER SET 'utf8'");

I've always used utf8 when setting the names and character set, so I can't say if the UTF-8 variant will work, but I guess it will :)

Thank you for all your helpful replies. I've added the two queries mentioned and everything seems to be working as it should.

 

Thanks again!

Bede

 

P.S. I assume the captcha will stop nagging me after I've made a few more posts? And how do I mark the question as solved?

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.