mikhak Posted March 15, 2015 Share Posted March 15, 2015 (edited) how to relplace � in a string ? i tested this code but not working . $mycode = str_replace('�','AB',$mycode); i want replace � with a word example AB plaese help me . thank you. Edited March 15, 2015 by mikhak Quote Link to comment https://forums.phpfreaks.com/topic/295253-how-to-relplace-%EF%BF%BD-in-a-string/ Share on other sites More sharing options...
requinix Posted March 15, 2015 Share Posted March 15, 2015 (edited) That's not (supposed to be) a problem that you simply find-and-replace your way around. It's being inserted by something, odds are your browser, because you've given it characters to display that aren't valid for the character set you told it to use. Where are you seeing that and what code and/or database do you have behind the scenes powering it? Edited March 15, 2015 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/295253-how-to-relplace-%EF%BF%BD-in-a-string/#findComment-1508120 Share on other sites More sharing options...
mikhak Posted March 15, 2015 Author Share Posted March 15, 2015 That's not (supposed to be) a problem that you simply find-and-replace your way around. It's being inserted by something, odds are your browser, because you've given it characters to display that aren't valid for the character set you told it to use. Where are you seeing that and what code and/or database do you have behind the scenes powering it? yes exactly i want to set char-set uft-8 for a string but display a glyph like � in the decoded string . i can't solve this probleme i trying all of methods but not solved. for example my string : $string = 'Ú†ÙŠ موقعي ميتوانيم برای خيار گلخانه از کود برگ جست است٠اده کنيم'; $decoded = mb_convert_encoding ($string, 'windows-1252', 'UTF-8'); decoded string in Persian language : چي موقعي ميتوانيم برای خيار گلخانه از کود برگ جست است� اده کنيم i think for solving this problem i can't use replace of � a i liked word . Quote Link to comment https://forums.phpfreaks.com/topic/295253-how-to-relplace-%EF%BF%BD-in-a-string/#findComment-1508121 Share on other sites More sharing options...
requinix Posted March 15, 2015 Share Posted March 15, 2015 (edited) Windows-1252 does not have those characters. Whatever you may be doing with conversions, going to or from Windows-1252 will not work. Edited March 15, 2015 by requinix Quote Link to comment https://forums.phpfreaks.com/topic/295253-how-to-relplace-%EF%BF%BD-in-a-string/#findComment-1508170 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.