Jump to content

Str_replace Wont Work!


[dx]

Recommended Posts

Hi, I'm getting problem when trying replace these chars. It wont work, but there are no any error message or something like that.

$find = array('č', 'ć', 'š', 'đ', 'ž');$replace = array('č', 'ć', 'š', 'đ', 'ž');  (these chars are in ASCII, but on forum shown on other way ex. č)$index['body'] = str_replace($find, $replace, $index['body']);

Link to comment
Share on other sites

It's strange.I have SMF forum installed, and one script which uses data from SMF's database. Everything is well, but char č ć and đ are shown as " ? "I'm using thisheader("Content-Type: text/html; charset=Windows-1250");Also tried UTF-8 and ISO-8859-1

Link to comment
Share on other sites

Now getting this for char čÄŤStrange
That's good. Now, if you give your page a UTF-8 encoding it will display correctly.Try adding this to your page (before anything else):
<?php header("Content-type: text/html;charset=UTF-8"); ?>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...