Hi everyone!
I want to send cyrillic letters with php, but it is not possible because php doesn't allow it. So, how do I covert the letters so that they could be sent.
<?php if (comments_open ()) : ?>
<div class="comment block" id="respond">
<div class="holder">
<h2><?php comment_form_title('[B]Остави коментар[/B]', 'Leave a Reply to %s');?></h2>
</div>
I have found this: (but I don't understand how to actually combine both codes)
function html_to_utf8 ($data)
{
return preg_replace("/\\&\\#([0-9]{3,10})\\;/e", '_html_to_utf8("\\1")', $data);
}
function _html_to_utf8 ($data)
{
if ($data > 127)
{
$i = 5;
while (($i--) > 0)
{
if ($data != ($a = $data % ($p = pow(64, $i))))
{
$ret = chr(base_convert(str_pad(str_repeat(1, $i + 1), 8, "0"), 2, 10) + (($data - $a) / $p));
for ($i; $i > 0; $i--)
$ret .= chr(128 + ((($data % pow(64, $i)) - ($data % ($p = pow(64, $i - 1)))) / $p));
break;
}
}
}
else
$ret = "&#$data;";
return $ret;
}
Example:
echo html_to_utf8("a b č ć ž こ に ち わ ()[]{}!#$?* < >");
Output:
a b č ć ž こ に ち わ ()[]{}!#$?* < >
Thanks in advance!