I have an app with an input field where you input your name. The app outputs the name on a pdf document with FPDF. As this app is in swedish, many people will input names with special character like å, ä, ö. The input looks like this:
$name = sanitize_text_field(base64_decode($_POST['name']));
And then to:
$specialCharacterName = iconv('UTF-8', 'windows-1252', $name);
It then outputs to FPDF like this:
$pdf->Cell(265,30,' '.$specialCharacterName,0,1,'L',1);
The problem is, as soon as I input a name with a special character, like Björn for example, the output will be blank. But when I input a name without a special character, like Anders, it displays fine.
The strange thing is that when I don't use a variable, and input a string with a special character like this:
$specialCharacterName = iconv('UTF-8', 'windows-1252', 'Björn');
It works fine. The special character is outputted just fine in the PDF document. So there must be something wrong with the variable.
I have also tried utf8_encode() and the result is the same. What am I missing?