There are texts in utf-8 format, they include unique characters (for example, Polish: ż ę ż etc.). How can I recode them to cp-1251 with minimal losses? I mean to encode unique characters in an html entity (for example: ξ).

My code looks like this:

$outputText = str_replace( array('&lt;', '&gt;'), array('<', '>'), htmlentities( iconv( "utf-8", DEFAULT_CHARSET, $inputText), ENT_NOQUOTES, DEFAULT_CHARSET ) ); 

PS I heard about the possibility of displaying blocks in a different encoding on pages with cp-1251 encoding - UTF-8, for example. How to do it? And will this help me?

  • 3
    Why do you need it? - Naumov
  • Just never use non-unicode encodings. Problem solved! - VladD
  • one
    @VladD in rare cases should be kept away from unicode. - strangeqargo 6:08 pm
  • Just to satisfy your interest. There is an old woman site who is 15 years old. There is no time to rewrite it (It is not possible to change only encodings) it is necessary to rewrite the entire engine (as it is tied inside to encodings). The site has a subdomain on UTF-8. SEO-Schnick said that under the domain moves to the main site we are doing. - Makarenko_I_V

0