0

I'm implementing facebook login on my site and the auth process works fine, but there is another problem. When I try to get the name of the user from the auth response, I'm getting this:

Array ( [name] => Ðиколай ДÑнков [image] => ...

This name is supposed to be in Cyrillic characters and I need to:

  1. Display it to the user in cyrilic
  2. Store it safely in database and be able to convert it back to cyrillic later

I tried using json_decode() and iconv() but no success. Maybe I can't get the parameters right. Please help!

4
  • Quite possibly it's your application's charset that's breaking it. You should only use UTF-8. Commented Nov 5, 2014 at 10:52
  • @Narf can you be a bit more specific? Commented Nov 5, 2014 at 10:56
  • I can't be more specific than 'use only UTF-8'. :) Commented Nov 5, 2014 at 11:19
  • @Narf Maybe he needs example of direct implementation. Commented Nov 5, 2014 at 11:25

1 Answer 1

2

Use header to modify the HTTP header:

header('Content-Type: text/html; charset=utf-8');

Place it at the top of your php file or at a common file which you include everywhere, such as config file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.