reliablec Posted September 15, 2008 Share Posted September 15, 2008 Hi everyone, I have a page where the ™ and ® are not displaying correctly. What I want to do is swap these values for the HTML codes ® and ™ respectively. When I try: preg_replace("/\™/", "™", $var_name); preg_replace("/\®/", "™", $var_name); These do not work. Does anyone have experience with swapping these symbols using preg_replace? Or are there other tools out there that I could use to perform this function? Your help is appreciated. Thanks Kent Link to comment https://forums.phpfreaks.com/topic/124395-preg_replace-%E2%84%A2-and-%C2%AE/ Share on other sites More sharing options...
JasonLewis Posted September 16, 2008 Share Posted September 16, 2008 Just use str_replace() for this kind of thing. $var_name = str_replace("™", "", $var_name); $var_name = str_replace("®", "®", $var_name); Link to comment https://forums.phpfreaks.com/topic/124395-preg_replace-%E2%84%A2-and-%C2%AE/#findComment-642614 Share on other sites More sharing options...
effigy Posted September 16, 2008 Share Posted September 16, 2008 ™ and ® are not displaying correctly How do they display? What encoding are you in? Link to comment https://forums.phpfreaks.com/topic/124395-preg_replace-%E2%84%A2-and-%C2%AE/#findComment-642845 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.