开发者

How do I convert arabic letters in htmlentities symbols?

开发者 https://www.devze.com 2023-04-05 04:03 出处:网络
I need convert arabic letters in htmlentities symbols. Codepage: ISO-8859-1. سك - this is arabic symbol for example.

I need convert arabic letters in htmlentities symbols. Codepage: ISO-8859-1.

سك - this is arabic symbol for example.

htmlentities("سك")

returns:

س� 

How can I 开发者_如何学编程get from this symbol the html-entities سك?


htmlentities() can do only characters that have named entities. See this question on how to convert arbitrary characters into numeric entities.


You're probably not targeting the correct charset. Try: htmlentities('سك', ENT_QUOTES, 'UTF-8');


i'm using a function to make sure there are no html code or cotation posted by user

function cleartext($x1){

    $x1 = str_replace('"','',$x1);
    $x1 = str_replace("'",'',$x1);
    $x1 = htmlentities($x1, ENT_QUOTES, 'UTF-8');
    return $x1;
}

so thank for ( ENT_QUOTES, 'UTF-8' ) it helped me to find what am looking for
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号