Any idea why I get an encoding error with this code?
$date_pre = get_field("date");
$date_s = date("j/n", strtotime($date_pre));
setlocale(LC_TIME,'sv_SE');
$month = strtolower(strftime("%B", strtotime($date_pre)));
$date_l = strftime("%A %e " . $month, strtotime($date_pre));
The $date_pre
is a ACF field that contains a date formated like this: 20180518
. When I then echo out $date_l
, which is a reformated variant of $date_pre
that puts in the weekday in swedish with the day number and the name of the month (Lördag 18 maj
), it can’t write out “åäö“. "ÅÄÖ" gets replaced with a question mark symbol. It works on my local setup, but not when I upload the theme to a server.