views:

106

answers:

1

i have a php script which detects keyword density on given url.

my problem is, it doesn't detect turkish characters or deletes them..

i'm getting contents of url by file_get_contents method. this method works perfect and gets all content with turkish characters.

you can see my code on http://www.gazihanisildak.com/keyword/code.txt or try script on www.gazihanisildak.com/keyword

thanks..

+2  A: 

You seem to be fetching and converting the file_get_contents data as UTF-8 (probably correctly), but your HTML page is not specifying an encoding for itself. So probably, any incoming form data is in iso-8859-1. Try specifying utf-8 as your page's encoding as well:

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

And the obligatory reading link on encoding basics: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)

Pekka
specified it but still same problem occurs. i think it's about other methods on script like string methods.for example you can try www.google.com.tr on http://www.gazihanisildak.com/keyword
I'm getting an error message on your link: Sistem veritabani ile baglanti kuramadi
Pekka
sorry for that. now it works
@user272483 you need to fix your markup first. At the moment, you are actually echoing the fetched content, resulting in two nested HTML pages. That can't work, remove the echo first. I'm off for today!
Pekka
thx but i'm echoing fetched content to see/show turkish characters are being fetched correctly..