"get first character of utf-8 string" Answer’s


There are several things you need to consider:

  1. Check that data in the DB is being stored as UTF-8
  2. Check that the client connection to the DB is in UTF-8 (for example, in mysql see: http://www.php.net/manual/en/mysqli.character-set-name.php)
  3. Make sure that the page has it's content-type set as UTF-8 [you can use header('Content-Type: utf-8'); ]
  4. Try setting the internal encoding, using mb_internal_encoding("UTF-8");
  5. Use mb_substr instead of array index notation
Wednesday, March 31, 2021
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :