I have a string which contains bullets • in the following format:
$string = "Yay bullets!!\n\\u2022\n\\u2022\n\\u2022\n\\u2022\n\\u2022\n#somany";
I need to echo the string displaying the bullets. The closest I've come to printing this out is by making $string = "\u2022";
and then echoing json_decode('"' . $string . '"');
which prints the bullet just fine.
When I try to do the same to the full $string
I get no result at all and no error.
Here are some things I have tried with their resulting output:
$raw = htmlspecialchars("Yay bullets!!\n\\u2022\n\\u2022\n\\u2022\n\\u2022\n\\u2022\n#yes", ENT_QUOTES);
echo $raw;
Result:
Yay bullets!!
\u2022
\u2022
\u2022
\u2022
\u2022
#yes
When I try:
echo mb_convert_encoding($raw, 'UTF-8', 'HTML-ENTITIES');
Result: Same as above. No change.
When I try:
echo json_decode('"' . $raw . '"');
Result: No output.
When I try:
echo mb_convert_encoding($raw, 'UTF-8', 'UTF-16BE');
Result: 奡礠扵汬整猡ℊ屵㈰㈲ੜ甲〲㈊屵㈰㈲ੜ甲〲㈊屵㈰㈲ਣ祥
I would really appreciate help figuring out how to output this properly.
Thanks.
EDIT
In addition to bullets, I am also failing to print emoji reference codes such as \\ud83d\\udc93
. Reference here: http://emojipedia.org/face-with-tears-of-joy/