0

php : 7.3

laravel : 7

the problem is i'm getting information with curl from some websites and the output is something like this:

هکس استور : ۶۱٫۷۴۹٫۰۰۰ تومان

when i return it from laravel or print it in some page it will be something like this:

آداک : ۵۸٫۳۴۴٫۰۰۰ تومان پارسان می : ۵۸٫۴۵۰٫۰۰۰ تومان های اپل : ۵۸٫۴۹۹٫۰۰۰ تومان تکسنولی : ۵۸٫۸۸۸٫۰۰۰ تومان لوتوس : ۵۹٫۰۹۹٫۰۰۰ تومان گجت : ۵۹٫۳۰۰٫۰۰۰ تومان های اپل : ۵۹٫۹۹۹٫۰۰۰ تومان آروند : ۶۱٫۰۸۰٫۰۰۰ تومان هکس استور : ۶۱٫۷۴۹٫۰۰۰

and its ok.

but i want to send it in telegram , and when i send it the output is looks like this:

enter image description here

i tried to figured out what encoding is whit mb_detect_encoding and its says its ASCII and also i tried to convert it to utf-8 but its seems ASCCI is kind of utf-8 and any way its driving me crazy.

this are some methods i tried and none of them works.

iconv('ASCII', 'UTF-8', $text); // output : the same ascii charachters and after it when detect it with mb_detect_encoding its says it is ASCII yet

utf8_encode($text) // output : the same ascii charachters and after it when detect it with mb_detect_encoding its says it is ASCII yet

mb_convert_encoding($text,'utf-8' , 'ascii'); // output : the same ascii charachters and after it when detect it with mb_detect_encoding its says it is ASCII yet

// i also used forcetoutf8 package
use \ForceUTF8\Encoding;
$utf8_string = Encoding::toUTF8($utf8_or_latin1_or_mixed_string);
// but the output was same

thanks in advance.

1 Answer 1

1

Of course ن is ASCII, because this relates to the text encoding, not what all those characters together might mean. What you have here is one HTML entity and it must be decoded into the character they represent.

In PHP you'd use html_entity_decode() on an entire text. See also Wikipedia: HTML > Entities.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.