Answer the question
In order to leave comments, you need to log in
How to process the string received via curl in this situation?
Hello. I've been suffering for half a day already ((
I have a site on cp1251.
Such a problem: If you paste a line from the Tradición
clipboard through the form for adding material to the site and click on submit, then this line is perfectly displayed along with the letter "ó". Then I do htmspecialchars("$_POST ['name']", ENT_QUOTES, '') -> I insert into MySQL.. I get a Tradici record in the database & # 243;n (I put spaces so that you can see the difference)
But, what to do in this situation?
I parse information from another site (which is in utf-8) via curl
Received string: Tradición .
Since I have a site on cp1251, this string has to be processed by iconv("utf-8", "cp1251//TRANSLIT", $name), as a result of which we get Tradici?n..
Tell me how can I replace this character with "ó " to its code in the symbol table ó , how do I do this when submitting the form for adding material? I need to add a line to the database Tradici & # 243;n
I would really appreciate your help.
Answer the question
In order to leave comments, you need to log in
<?
$string = 'a good apple';
$symbol = 'a';
$ascii = ord($symbol);
$string = str_replace($symbol, "&#$ascii;", $string);
?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question