miojamo
miojamo

Reputation: 747

array_key_exists Cyryllic characters

Can't get this to work with Cyrillic characters:

if (array_key_exists($list['fname'], $data)) {

}

Array keys are Cyrillic characters

Please help

Upvotes: 0

Views: 1015

Answers (2)

Shiplu Mokaddim
Shiplu Mokaddim

Reputation: 57640

If $list['fname'] is coming form mysql make sure you use UTF-8 charset and utf8_general_ci as collation. If its hard coded, save your php file as UTF-8.

Also you can always use a hash for the text as key.

Upvotes: 1

Patches
Patches

Reputation: 1125

Are all the cyrillic characters working otherwise? It seems it's probably over-runing the character set -- by default php is ansii, if I remember right. You need UTF-8.

In any case, put this at the top of that php file and see if that helps:

<?php
   ini_set('default_charset', 'UTF-8');

Upvotes: 1

Related Questions