timmy01 Posted September 5, 2006 Share Posted September 5, 2006 Hi guys,what is the best and fastest / easiest wayto filter symbols like ëíñçíàéö etc.???cheerzTim Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/ Share on other sites More sharing options...
Nicklas Posted September 6, 2006 Share Posted September 6, 2006 with "filter", you mean remove them?You could place all the letters you wanna remove in an array and then use str_ireplace() (if you use PHP 5) to delete them.ex:[color=blue]<?php$string = 'bla bla bla ëíñçíàéö bla bla ñç...';$chars = array('ë', 'í', 'ñ', 'ç', 'í', 'à', 'é', 'ö');echo str_ireplace($chars, '', $string);?>[/color] Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-87195 Share on other sites More sharing options...
effigy Posted September 6, 2006 Share Posted September 6, 2006 Why are you filtering these? You can remove non-ASCII characters via:[code]<pre><?php $string = 'to filter symbols like ëíñçíàéö etc.'; echo preg_replace('/[^\x0-\x7f]/', '', $string);?></pre>[/code] Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-87206 Share on other sites More sharing options...
timmy01 Posted September 7, 2006 Author Share Posted September 7, 2006 no i mean replace them with like this:ë=>eí=>iñ=>nç=cí=>ià=>aé=>eö=>o ... Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-87631 Share on other sites More sharing options...
Nicklas Posted September 7, 2006 Share Posted September 7, 2006 [code=php:0]<?php$string = 'bla bla bla ëíñçíàéö bla bla ñç...';$change = array('ë', 'í', 'ñ', 'ç', 'í', 'à', 'é', 'ö');$tothis = array('a', 'i', 'n', 'c', 'i', 'a', 'e', 'o');echo str_replace($change, $tothis, $string);?>[/code] Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-87722 Share on other sites More sharing options...
effigy Posted September 7, 2006 Share Posted September 7, 2006 Have a look at [url=http://www.phpfreaks.com/forums/index.php/topic,100331.msg395933.html#msg395933]this[/url] post. Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-87753 Share on other sites More sharing options...
kevins Posted September 25, 2006 Share Posted September 25, 2006 It does not work if $change contains non-ASCII chars like α - β - Ğ - ğ - İ - ı - Ş - ş<?php$string = 'bla bla bla ëíñçíàéö bla bla ñç...';$change = array("α", "β", "Ğ", "ğ" );$tothis = array('a', 'i', 'n', 'c', 'i', 'a', 'e', 'o');echo str_replace($change, $tothis, $string);?> Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-98018 Share on other sites More sharing options...
effigy Posted October 5, 2006 Share Posted October 5, 2006 I ran across [url=http://us2.php.net/manual/en/function.mb-convert-encoding.php#69412]this[/url]; "some code to convert latin diacritics to their traditional 7bit representation." Link to comment https://forums.phpfreaks.com/topic/19767-howto-filter-symbols-like-%C3%AB%C3%AD%C3%B1%C3%A7%C3%AD%C3%A0%C3%A9%C3%B6-etc/#findComment-104377 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.