The Little Guy Posted October 31, 2008 Share Posted October 31, 2008 Is there a function that can search for these types of characters: 上海帕特是水泵和阀门的专业的生产商。其产å“é€šè¿‡ä¸æ–的技术改进和更新æ¢ä»£ï¼Œäº§å“如下: Link to comment https://forums.phpfreaks.com/topic/130891-special-characters-function/ Share on other sites More sharing options...
vicodin Posted October 31, 2008 Share Posted October 31, 2008 There is no specific one that does that but you can use preg or ereg and you can make it evaluate the variable and it will let you know true or false if there are any special characters in there. Link to comment https://forums.phpfreaks.com/topic/130891-special-characters-function/#findComment-679518 Share on other sites More sharing options...
DarkWater Posted October 31, 2008 Share Posted October 31, 2008 There is no specific one that does that but you can use preg or ereg and you can make it evaluate the variable and it will let you know true or false if there are any special characters in there. Actually, ereg() can't be used on binary data. Go with preg_match(). Link to comment https://forums.phpfreaks.com/topic/130891-special-characters-function/#findComment-679748 Share on other sites More sharing options...
Jeremysr Posted November 1, 2008 Share Posted November 1, 2008 Try this regex: if (preg_match('/[^\x20-\x7e]/', $text) { // there are special characters in $text } The character class [^\x20-\x7e] matches all characters with ASCII codes less than 0x20 and greater than 0x7e. Link to comment https://forums.phpfreaks.com/topic/130891-special-characters-function/#findComment-679753 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.