-3

I’m setting up a new server, and want to support UTF-8 fully in my web application. Where do I need to set the encoding/charsets?

This is for a new Linux server, running MySQL 5, PHP 5 and Apache 2. In the past, I’ve tried on existing servers and always seem to end up having to fall back to ISO-8859-1.

def function(foo):
    print(foo)
  • Why did you tag the question with c# and python when the question is about PHP? –  Oct 18 '19 at 15:42
  • …and the code snippet is a non sequitur in Python…?! – deceze Oct 18 '19 at 15:44
  • please clarify what you are asking the above function is not written in PHP. what do you want to know supporting charset or 'Headers already sent' error – Amit Bisht Oct 18 '19 at 15:47
  • If you are still using PHP 5 I strongly recommend to upgrade as soon as possible. This version is no longer supported. [Let Rasmus Lerdorf explain it to you](https://youtu.be/wCZ5TJCBWMg?t=2434) – Dharman Oct 19 '19 at 22:49

1 Answers1

-1

Make sure no text is outputted (ob_start and ob_end_clean() may prove useful here). You could then set a cookie or session equal to ob_get_contents() and then use ob_end_clean() to clear the buffer