Jump to content

Str_replace Wont Work!


[dx]
 Share

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']);

Edited by Haris S
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...