mavera2 Posted October 11, 2011 Share Posted October 11, 2011 after some parsing of an outer site, i set the variable $word1 to the obtained string. when i make $word1Encod=mb_detect_encoding($word1); it gives ASCII. i have a string like: $mycomment="başlamış bugün" then $mycommentEncod=mb_detect_encoding($mycomment); it gives UTF-8. when i join them as $joined= $word1 . $mycomment; it gives UTF-8. But the final string has characters like ü ı which are turkish characters, which are found in variable $word1. Although UTF-8 includes ASCII characters, I tried mb_convert_encoding($word1,"UTF-8","ASCII"); But still it didn't help. My php file's encoding is UTF-8. I tried UTF-8 without BOM, as well. Do you have any recommendation? Thank you Quote Link to comment https://forums.phpfreaks.com/topic/248916-utf-8-ascii-encoding-errors/ Share on other sites More sharing options...
requinix Posted October 11, 2011 Share Posted October 11, 2011 Recommendation for what? What's the problem? Quote Link to comment https://forums.phpfreaks.com/topic/248916-utf-8-ascii-encoding-errors/#findComment-1278389 Share on other sites More sharing options...
mavera2 Posted October 13, 2011 Author Share Posted October 13, 2011 The problem is, in an UTF-8 coded php file, when i join an ASCII coded string with UTF coded string, feed readers show ASCII characters of strings as Ü ü etc. Quote Link to comment https://forums.phpfreaks.com/topic/248916-utf-8-ascii-encoding-errors/#findComment-1279145 Share on other sites More sharing options...
requinix Posted October 13, 2011 Share Posted October 13, 2011 You can't convert Turkish characters into ASCII encoding. How are you generating the XML? I suspect the problem is that whatever you use is turning the UTF-8 octets into numeric HTML entities. Probably because it doesn't know better: wrong encoding on the feed, not smart enough... Quote Link to comment https://forums.phpfreaks.com/topic/248916-utf-8-ascii-encoding-errors/#findComment-1279155 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.