I have just of question if it is possible to replace hexadecimal values in string: for example in long string with windows 1250 encoding (XX) to 2 bytes value in UTF-8 (XX XX)?
Thank you for answers!
Thank you for answers!
| rudi wrote: |
| I would like to replace just 5 (strange and non visible) characters with their XX XX value in UTF-8 format. |
| Code: |
| <?php
$cs = rand(0, 1); if (!$cs) header('Content-Type: text/html; charset=windows-1250'); else header('Content-Type: text/html; charset=utf-8'); if (!$cs) echo 'windows-1250<br><br>'; else echo 'utf-8<br><br>'; $s = "x\xC5x z\xC4\xB9z"; echo $s, '<br>'; if ($cs) echo str_replace("\xC5", "\xC4\xB9", $s); ?> |
| rudi wrote: |
| Yes it works "on the fly", thank you again hexkid! |