Problem: periodically appears looping in CHROME. There is a search page on the site. When a user enters characters in the Latin alphabet, they are translated, that is, translated into Russian-Ukrainian characters. In portoble CHROME there is a looping and sometimes in regular Chrome. In FF, IE works fine. What could be the reason? Code: (file - html, encoding 1251)

<?php preg_match_all("/[a-zA-Z]/",$search_sp, $out); if( (count($out[0]) > 0) && (strlen($search_sp) > 3) ){ $trans_sph = translitSph(strtolower($search_sp), $lng); echo '<script> window.location.href = "' . SITEURL . '/search/?search=' . urlencode($trans_sph) . '" </script>'; } ?> /// html html ................. <?php function translitSph($search_sp,$lng){ if($lng == 1){ $translit = array( "q"=>"й", "w"=>"ц", "e"=>"у", "r"=>"к", "t"=>"е", "y"=>"н", "u"=>"г", "i"=>"ш", "o"=>"щ", "p"=>"з", "["=>"х", "]"=>"ъ", "a"=>"ф", "s"=>"ы", "d"=>"в", "f"=>"а", "g"=>"п", "h"=>"р", "j"=>"о", "k"=>"л", "l"=>"д", ";"=>"ж", "'"=>"э", "z"=>"я", "x"=>"ч", "c"=>"с", "v"=>"м", "b"=>"и", "n"=>"т", "m"=>"ь", ","=>"б", "."=>"ю" ); }else { $translit = array( "q"=>"й", "w"=>"ц", "e"=>"у", "r"=>"к", "t"=>"е", "y"=>"н", "u"=>"г", "i"=>"ш", "o"=>"щ", "p"=>"з", "["=>"х", "]"=>"ї", "a"=>"ф", "s"=>"і", "d"=>"в", "f"=>"а", "g"=>"п", "h"=>"р", "j"=>"о", "k"=>"л", "l"=>"д", ";"=>"ж", "'"=>"є", "z"=>"я", "x"=>"ч", "c"=>"с", "v"=>"м", "b"=>"и", "n"=>"т", "m"=>"ь", ","=>"б", "."=>"ю", "\\"=>"ґ" ); } $word = strtr($search_sp, $translit); //return $word = iconv('UTF-8', 'windows-1251',$word); return $word ; } ?> 

Outcome: Input: ghbdtn; Expected: hello; Result: hello (IE, Opera, FF, Chrome) Result in portable Chrome: looping; While trying to retrieve the URL: test.com/search/?search=%2525252525252525252525252525252525.‌ ..........

  • What is $search_sp ? - vp_arth
  • user request. Pr .: ukrUkrkyrs - Web Lips
  • Isn't it from $_GET['search'] ? - vp_arth
  • yes from get. Problem with encoding? - Web Lips
  • This is where your utf-8 encoding is in function ... - vp_arth

0