My problem is the following:
I store an array, which has keys like "e", "f", etc. At some point, I have to get the value of the key. This works well. But if I want to store "í", "é", etc. as the keys, it won't produce the right result (results in �). My page has to be in UTF-8. Looking up the problem, I found out that utf8_encode should help my problem. It didn't: although it produced a more-readable character, it still totally differed from what I want. If important, phpinfo gives:
Directive Local Value Master Value
iconv.input_encoding ISO-8859-1 ISO-8859-1
iconv.internal_encoding ISO-8859-1 ISO-8859-1
iconv.output_encoding ISO-8859-1 ISO-8859-1
What could help the problem?
Edit: I think that array keys make some data loss. Is it true? If yes, how to prevent?
Edit2: Solutions I've tried so far: get the array key value - failed; make an array with same keys but a values of utf-8 characters: failed; utf8_encode failed; [tried with both] iconv_set_encoding: failed; ini_set failed; mb_internal_encoding failed. All returned with either à or �.
ISO-8859-1
encoded according to these settings. That's totally unrelated toutf8_encode
. Check with your browser which encoding applies. – Janieiconv_set_encoding("input_encoding", "UTF-8");iconv_set_encoding("internal_encoding", "UTF-8"); iconv_set_encoding("output_encoding", "UTF-8");
to my code but the issue is still there – Ingraham