I have a database where the fields are stored in UTF8 and utf_general_ci. I'm pulling the data from the database and I then want to see if a pulled value is in a fixed array which I've coded into php (array("home","Über
uns","strona główna")).
For some reason this doesn't seem to work. I've tried setting the Internal/External/Output character encodings and played with other settings, including utf8_en/decoding it as well. Even though in text, the value from MySQL reads "strona główna" (which I believe means Home page in Polish) it doesn't get found with in_array.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
I am using SET NAMES so the data should be coming out as UTF8 but it won't compare with the array. I'm not sure if I need to set something in PHP to make my array get read as fully UTF8 - even if the characters themselves are UTF8?
If the array is hard coded, and your IDE is using UTF-8, then I can't see any reason why it wouldn't compare. I just ran a test and it worked fine for me. All I can think of is that your IDE is using something other than UTF-8.
Thank you for that help!!! That fixed it. I'm using PSPad and had obviously not encoded the actual PHP file correctly! Simple but annoying as I've not really used international codings before.
Bookmarks