I am trying to use superscript in php for numbers from ¹-⁹. I am using utf8_decode() to achieve this and it works fine for ¹, ² and ³ digits. But does not work for more than that. That is from digit ⁴ - ⁹, I get "?" as output. Why does this happen?
<?php
$val = utf8_decode("⁴");
echo $val;
?>
I also have tried doing
json_decode("\u{2074}")
but does not work. (https://wiki.freepascal.org/Unicode_subscripts_and_superscripts)
EDIT: I have now integrated https://github.com/neitanod/forceutf8 library to force my php to encode in utf-8. I am trying to directly encode for string ⁴ but it does not work. It outputs "?".
<?php
require_once "./vendor/forceutf/src/ForceUTF8/Encoding.php";
use ForceUTF8\Encoding;
$val = Encoding::fixUTF8("⁴");
echo $val;
?>