ppc Posted September 4, 2010 Report Share Posted September 4, 2010 Lieta tāda kad kko nepareizi daru ar russ burtiem viss strādā, bet ar latviešu burtiem (Kuri ir aizkomentēti ar "//") uz mājaslapas paliek balta lapa... Vai kāds nevar pateikt kur mana kļūda un vai pareizi kodēti mīkstinājuma un garumzīmju simboli. function rus_to_k($str) { $str = str_replace("a","a",$str); $str = str_replace("ā","aa",$str); $str = str_replace("b","b",$str); $str = str_replace("c","c",$str); $str = str_replace("č","ch",$str); $str = str_replace("d","d",$str); $str = str_replace("e","e",$str); $str = str_replace("ē","ee",$str); $str = str_replace("f","f",$str); $str = str_replace("g","g",$str); $str = str_replace("ģ","gj",$str); $str = str_replace("h","h",$str); $str = str_replace("i","i",$str); $str = str_replace("ī","ii",$str); $str = str_replace("j","j",$str); $str = str_replace("k","k",$str); $str = str_replace("ķ","kj",$str); $str = str_replace("l","l",$str); $str = str_replace("ļ","lj",$str); $str = str_replace("n","n",$str); $str = str_replace("ņ","nj",$str); $str = str_replace("o","o",$str); $str = str_replace("p","p",$str); $str = str_replace("r","r",$str); $str = str_replace("s","s",$str); $str = str_replace("š","sh",$str); $str = str_replace("t","t",$str); $str = str_replace("u","u",$str); $str = str_replace("ū","uu",$str); $str = str_replace("v","v",$str); $str = str_replace("z","z",$str); $str = str_replace("ž","zh",$str); $str = str_replace("A","A",$str); $str = str_replace("Ā","AA",$str); $str = str_replace("B","B",$str); $str = str_replace("C","C",$str); $str = str_replace("Č","CH",$str); $str = str_replace("D","D",$str); $str = str_replace("E","E",$str); $str = str_replace("Ē","EE",$str); $str = str_replace("F","F",$str); $str = str_replace("G","G",$str); $str = str_replace("Ģ","GJ",$str); $str = str_replace("H","H",$str); $str = str_replace("I","I",$str); $str = str_replace("Ī","II",$str); $str = str_replace("J","J",$str); $str = str_replace("K","K",$str); $str = str_replace("Ķ","KJ",$str); $str = str_replace("L","L",$str); $str = str_replace("Ļ","LJ",$str); $str = str_replace("M","M",$str); $str = str_replace("N","N",$str); $str = str_replace("Ņ","NJ",$str); $str = str_replace("O","O",$str); $str = str_replace("P","P",$str); $str = str_replace("R","R",$str); $str = str_replace("S","S",$str); $str = str_replace("Š","SH",$str); $str = str_replace("T","T",$str); $str = str_replace("U","U",$str); $str = str_replace("Ū","UU",$str); $str = str_replace("V","V",$str); $str = str_replace("Z","Z",$str); $str = str_replace("Ž","ZH",$str); return $str; } function win_to_utf($str) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'utf-8', 'windows-1251'); if (function_exists('iconv')) return iconv('windows-1251', 'utf-8', $str); $win1251utf8 = array( //"\A"=>"А","\0x0100"=>"Ā","\B"=>"B","\C"=>"C","\0x010C"=>"Č","\D"=>"D","\E"=>"E","\0x0112"=>"Ē","\F"=>"F","\G"=>"G","\0x0122"=>"Ģ","\H"=>"H","\I"=>"I","\0x012A"=>"Ī", //"\J"=>"J","\K"=>"K","\0x0136"=>"Ķ","\L"=>"L","\0x013B"=>"Ļ","\M"=>"M","\N"=>"N","\0x0145"=>"Ņ","\O"=>"0","\P"=>"P","\R"=>"R","\S"=>"S","\0x0160"=>"Š","\T"=>"T","\U"=>"U","\0x016A"=>"Ū","\V"=>"V","\Z"=>"Z","\0x017D"=>"Ž", //"\a"=>"a","\0x0101"=>"ā","\b"=>"b","\c"=>"c","\0x010D"=>"č","\d"=>"d","\e"=>"e","\0x0113"=>"ē","\f"=>"f","\g"=>"g","\0x01E7"=>"ģ","\h"=>"h","\i"=>"i","\0x012B"=>"ī", //"\j"=>"j","\k"=>"k","\0x0137"=>"ķ","\l"=>"l","\0x013C"=>"ļ","\m"=>"n","\0x0146"=>"ņ","\o"=>"o","\p"=>"p","\r"=>"r","\s"=>"s","\0x0161"=>"š","\t"=>"t","\u"=>"u","\0x016B"=>"ū","\v"=>"v","\z"=>"z","\0x017E"=>"ž", "\xC0"=>"А","\xC1"=>"Б","\xC2"=>"В","\xC3"=>"Г","\xC4"=>"Д","\xC5"=>"Е","\xA8"=>"Ё","\xC6"=>"Ж","\xC7"=>"З","\xC8"=>"И","\xC9"=>"Й","\xCA"=>"К","\xCB"=>"Л","\xCC"=>"М", "\xCD"=>"Н","\xCE"=>"О","\xCF"=>"П","\xD0"=>"Р","\xD1"=>"С","\xD2"=>"Т","\xD3"=>"У","\xD4"=>"Ф","\xD5"=>"Х","\xD6"=>"Ц","\xD7"=>"Ч","\xD8"=>"Ш","\xD9"=>"Щ","\xDA"=>"Ъ", "\xDB"=>"Ы","\xDC"=>"Ь","\xDD"=>"Э","\xDE"=>"Ю","\xDF"=>"Я","\xE0"=>"а","\xE1"=>"б","\xE2"=>"в","\xE3"=>"г","\xE4"=>"д","\xE5"=>"е","\xB8"=>"ё","\xE6"=>"ж","\xE7"=>"з", "\xE8"=>"и","\xE9"=>"й","\xEA"=>"к","\xEB"=>"л","\xEC"=>"м","\xED"=>"н","\xEE"=>"о","\xEF"=>"п","\xF0"=>"р","\xF1"=>"с","\xF2"=>"т","\xF3"=>"у","\xF4"=>"ф","\xF5"=>"х", "\xF6"=>"ц","\xF7"=>"ч","\xF8"=>"ш","\xF9"=>"щ","\xFA"=>"ъ","\xFB"=>"ы","\xFC"=>"ь","\xFD"=>"э","\xFE"=>"ю","\xFF"=>"я"); return strtr($str, $win1251utf8); } function utf_to_win($str) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'windows-1251', 'utf-8'); if (function_exists('iconv')) return iconv('utf-8', 'windows-1251', $str); $utf8win1251 = array( //"A"=>"\A","Ā"=>"\0x0100","B"=>"\B","C"=>"\C","Č"=>"\0x010C","D"=>"\D","E"=>"\E","Ē"=>"\0x0112","F"=>"\F","G"=>"\G","Ģ"=>"\0x0122","H"=>"\H","I"=>"\I","Ī"=>"\0x012A", //"J"=>"\J","K"=>"\K","Ķ"=>"\0x0136","L"=>"\L","Ļ"=>"\0x013B","M"=>"\M","N"=>"\N","Ņ"=>"\0x0145","O"=>"\O","P"=>"\P","R"=>"\R","S"=>"\S","Š"=>"\0x0160","T"=>"\T","U"=>"\U","Ū"=>"\0x016B","V"=>"\V","Z"=>"\Z","Ž"=>"\0x017D", //"a"=>"\a","ā"=>"\0x0101","b"=>"\b","c"=>"\c","č"=>"\0x010D","d"=>"\d","e"=>"\e","ē"=>"\0x0113","f"=>"\f","g"=>"\g","ģ"=>"\0x01E7","h"=>"\h","i"=>"\i","ī"=>"\0x012B", //"j"=>"\j","k"=>"\k","ķ"=>"\0x0137","l"=>"\l","ļ"=>"\0x013C","m"=>"\m","n"=>"\n","ņ"=>"\0x0146","o"=>"\o","p"=>"\p","r"=>"\r","s"=>"\s","š"=>"\0x0161","t"=>"\t","u"=>"\u","ū"=>"\0x016B","v"=>"\v","z"=>"\z","ž"=>"\0x017E", "А"=>"\xC0","Б"=>"\xC1","В"=>"\xC2","Г"=>"\xC3","Д"=>"\xC4","Е"=>"\xC5","Ё"=>"\xA8","Ж"=>"\xC6","З"=>"\xC7","И"=>"\xC8","Й"=>"\xC9","К"=>"\xCA","Л"=>"\xCB","М"=>"\xCC", "Н"=>"\xCD","О"=>"\xCE","П"=>"\xCF","Р"=>"\xD0","С"=>"\xD1","Т"=>"\xD2","У"=>"\xD3","Ф"=>"\xD4","Х"=>"\xD5","Ц"=>"\xD6","Ч"=>"\xD7","Ш"=>"\xD8","Щ"=>"\xD9","Ъ"=>"\xDA", "Ы"=>"\xDB","Ь"=>"\xDC","Э"=>"\xDD","Ю"=>"\xDE","Я"=>"\xDF","а"=>"\xE0","б"=>"\xE1","в"=>"\xE2","г"=>"\xE3","д"=>"\xE4","е"=>"\xE5","ё"=>"\xB8","ж"=>"\xE6","з"=>"\xE7", "и"=>"\xE8","й"=>"\xE9","к"=>"\xEA","л"=>"\xEB","м"=>"\xEC","н"=>"\xED","о"=>"\xEE","п"=>"\xEF","р"=>"\xF0","с"=>"\xF1","т"=>"\xF2","у"=>"\xF3","ф"=>"\xF4","х"=>"\xF5", "ц"=>"\xF6","ч"=>"\xF7","ш"=>"\xF8","щ"=>"\xF9","ъ"=>"\xFA","ы"=>"\xFB","ь"=>"\xFC","э"=>"\xFD","ю"=>"\xFE","я"=>"\xFF"); return strtr($str, $utf8win1251); } function trun_to_rus($str) { $str=str_replace("AA","Ā",$str); $str=str_replace("aa","ā",$str); $str=str_replace("CH","Č",$str); $str=str_replace("ch","č",$str); $str=str_replace("EE","Ē",$str); $str=str_replace("ee","ē",$str); $str=str_replace("GJ","Ģ",$str); $str=str_replace("gj","ģ",$str); $str=str_replace("II","Ī",$str); $str=str_replace("ii","ī",$str); $str=str_replace("KJ","Ķ",$str); $str=str_replace("kj","ķ",$str); $str=str_replace("LJ","Ļ",$str); $str=str_replace("lj","ļ",$str); $str=str_replace("NJ","Ņ",$str); $str=str_replace("nj","ņ",$str); $str=str_replace("SH","Š",$str); $str=str_replace("sh","š",$str); $str=str_replace("UU","Ū",$str); $str=str_replace("uu","ū",$str); $str=str_replace("ZH","Ž",$str); $str=str_replace("zh","ž",$str); $str=strtr($str,array("a"=>"a", "aa"=>"ā", "b"=>"b", "c"=>"c", "ch"=>"č", "d"=>"d", "e"=>"e", "ee"=>"ē", "f"=>"f", "g"=>"g", "gj"=>"ģ", "h"=>"h", "i"=>"i", "ii"=>"ī", "j"=>"j", "k"=>"k", "kj"=>"ķ", "l"=>"l", "lj"=>"ļ", "m"=>"m", "n"=>"n", "nj"=>"ņ", "o"=>"o", "p"=>"p", "r"=>"r", "s"=>"s", "sh"=>"š", "t"=>"t", "u"=>"u", "uu"=>"ū", "v"=>"v", "z"=>"z", "zh"=>"ž", "A"=>"A", "AA"=>"Ā", "B"=>"B", "C"=>"C", "CH"=>"Č", "D"=>"D", "E"=>"E", "EE"=>"Ē", "F"=>"F", "G"=>"G", "GJ"=>"Ģ", "H"=>"H", "I"=>"I", "II"=>"Ī", "J"=>"J", "K"=>"K", "KJ"=>"Ķ", "L"=>"L", "LJ"=>"Ļ", "M"=>"M", "N"=>"N", "NJ"=>"Ņ", "O"=>"O", "P"=>"P", "R"=>"R", "S"=>"S", "SH"=>"Š", "T"=>"T", "U"=>"U", "UU"=>"Ū", "V"=>"V", "Z"=>"Z", "ZH"=>"Ž")); return $str; } function check($message) { $message=str_replace("|","I",$message); $message=str_replace("||","I",$message); $message=htmlspecialchars($message); $message = str_replace("\r\n", "<br/>", $message); $message = strtr($message, array(chr("1") => "", chr("2") => "", chr("3") => "", chr("4") => "", chr("5") => "", chr("6") => "", chr("7") => "", chr("8") => "", chr("9") => "", chr("10") => "", chr("11") => "", chr("12") => "", chr ("13") => "", chr("14") => "", chr("15") => "", chr("16") => "", chr("17") => "", chr("18") => "", chr("19") => "", chr("20") => "", chr("21") => "", chr("22") => "", chr("23") => "", chr("24") => "", chr("25") => "", chr("26") => "", chr("27") => "", chr("28") => "", chr("29") => "", chr("30") => "", chr("31") => "")); $message = iconv('utf-8', 'windows-1251', $message); $message = substr($message, 0, 1000); $message = iconv('windows-1251', 'utf-8', $message); $message=str_replace("'","'",$message); $message=str_replace("\"",""",$message); $message=str_replace("\$","$",$message); $message=str_replace("$","$",$message); $message=str_replace("\\","\", $message); $message=str_replace("`","`", $message); $message=str_replace("^","^", $message); $message=str_replace("%","%", $message); $message=str_replace(":",":",$message); $message=preg_replace("|:|",":",$message,3); $message=stripslashes(trim($message)); return $message; } function replace_rus($str) { $str = str_replace("a","|",$str); $str = str_replace("ā","|",$str); $str = str_replace("b","|",$str); $str = str_replace("c","|",$str); $str = str_replace("č","|",$str); $str = str_replace("d","|",$str); $str = str_replace("e","|",$str); $str = str_replace("ē","|",$str); $str = str_replace("f","|",$str); $str = str_replace("g","|",$str); $str = str_replace("ģ","|",$str); $str = str_replace("h","|",$str); $str = str_replace("i","|",$str); $str = str_replace("ī","|",$str); $str = str_replace("j","|",$str); $str = str_replace("k","|",$str); $str = str_replace("ķ","|",$str); $str = str_replace("l","|",$str); $str = str_replace("ļ","|",$str); $str = str_replace("n","|",$str); $str = str_replace("ņ","|",$str); $str = str_replace("o","|",$str); $str = str_replace("p","|",$str); $str = str_replace("r","|",$str); $str = str_replace("s","|",$str); $str = str_replace("š","|",$str); $str = str_replace("t","|",$str); $str = str_replace("u","|",$str); $str = str_replace("ū","|",$str); $str = str_replace("v","|",$str); $str = str_replace("z","|",$str); $str = str_replace("ž","|",$str); $str = str_replace("A","|",$str); $str = str_replace("Ā","|",$str); $str = str_replace("B","|",$str); $str = str_replace("C","|",$str); $str = str_replace("Č","|",$str); $str = str_replace("D","|",$str); $str = str_replace("E","|",$str); $str = str_replace("Ē","|",$str); $str = str_replace("F","|",$str); $str = str_replace("G","|",$str); $str = str_replace("Ģ","|",$str); $str = str_replace("H","|",$str); $str = str_replace("I","|",$str); $str = str_replace("Ī","|",$str); $str = str_replace("J","|",$str); $str = str_replace("K","|",$str); $str = str_replace("Ķ","|",$str); $str = str_replace("L","|",$str); $str = str_replace("Ļ","|",$str); $str = str_replace("M","|",$str); $str = str_replace("N","|",$str); $str = str_replace("Ņ","|",$str); $str = str_replace("O","|",$str); $str = str_replace("P","|",$str); $str = str_replace("R","|",$str); $str = str_replace("S","|",$str); $str = str_replace("Š","|",$str); $str = str_replace("T","|",$str); $str = str_replace("U","|",$str); $str = str_replace("Ū","|",$str); $str = str_replace("V","|",$str); $str = str_replace("Z","|",$str); $str = str_replace("Ž","|",$str); return $str; } Quote Link to comment Share on other sites More sharing options...
viena tante Posted September 4, 2010 Report Share Posted September 4, 2010 Nezinu par pārejo, bet problēmas ar pēdiņām un slašiem noteikti ir: $message=str_replace("\"",""",$message); $message=str_replace("\\","\", $message); $message=str_replace("`","&\#96", $message); Quote Link to comment Share on other sites More sharing options...
briedis Posted September 4, 2010 Report Share Posted September 4, 2010 Wft? $message=str_replace("'","'",$message); $message=str_replace("$","$",$message); $str = str_replace("l","l",$str); utt... Īpašie simboli ir jāeskeipo ar "\". (http://www.php.net/manual/en/language.types.string.php) Quote Link to comment Share on other sites More sharing options...
ppc Posted September 4, 2010 Author Report Share Posted September 4, 2010 (edited) Wft? $message=str_replace("'","'",$message); $message=str_replace("$","$",$message); $str = str_replace("l","l",$str); utt... Īpašie simboli ir jāeskeipo ar "\". (http://www.php.net/manual/en/language.types.string.php) Vēlreiz atkārtoju vis strādā ideāli izņemot latviešu simbolus! kad aizkomentēju ar "//" russ variantu un atkomentēju lv. Nevaru saprast kur man tur kļūda un vai pareizi kodētas mīkstinājuma zīmes un garumzīmes. Edited September 4, 2010 by ppc Quote Link to comment Share on other sites More sharing options...
briedis Posted September 4, 2010 Report Share Posted September 4, 2010 Nafig repleisot slešus un pēc tam vēl izmantot funkciju stripslashes?? Vai nebūtu prātīgāk vispirms izmantot un viss? Un kā es jau teicu, vajag eskeipot speciālos simbolus, kas bija minēti linkā ko tev devu. Varbūt arī varētu iedot kļūdas paziņojumu? Padomā par šīm te rindiņām: $message=str_replace("\"",""",$message); $message=str_replace("\$","$",$message); $message=str_replace("$","$",$message); $message=str_replace("\\","\", $message); Quote Link to comment Share on other sites More sharing options...
ppc Posted September 4, 2010 Author Report Share Posted September 4, 2010 (edited) Sry es neesmu tik gudrs tik iesācējs. Vai nevari pielabot un atzīmēt kur bij un kā jālabo lūdzu? <?php $adminmail = "lala@lala.lv";$site = "<a href=\"http://lala.lv\">lala.lv";$copy = "lala.lv"; $ver = trim(addslashes(htmlspecialchars($ver))); $dtd = '<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN" "http://www.wapforum.org/DTD/wml12.dtd">';$xml = '<?xml version="1.0" encoding="UTF-8"?>'; function show_error($err) { global $dtd, $xml; if ($ver == "wml") { echo $xml; echo $dtd; echo '<wml><card id="error" title="Kļūda"> <do type="prev" label="Back"><prev/></do> <p align="center"> '.$err.'<br/> ---<br/> Mēģiniet ienākt vēlāk. </p></card></wml>'; } else { echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> <html xmlns=\"http://www.w3.org/1999/xhtml\"> <head><link rel=\"stylesheet\" type=\"text/css\" href=\"css/$css.css\"/> <title>Kļūda</title> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/></head><body> <div align=\"center\"> $err<br/> ---<br/> Mēģiniet ienākt vēlāk. </div></body></html>"; }} function getmicrotime(){ list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function filtr($a) {$text1 = array("\r\n", "\n");$text2 = array(" ", " ");$a = trim(htmlspecialchars(stripslashes(str_replace($text1, $text2, $a))));return $a;} function rus_to_k($str) { $str = str_replace("a","a",$str); $str = str_replace("ā","aa",$str); $str = str_replace("b","b",$str); $str = str_replace("c","c",$str); $str = str_replace("č","ch",$str); $str = str_replace("d","d",$str); $str = str_replace("e","e",$str); $str = str_replace("ē","ee",$str); $str = str_replace("f","f",$str); $str = str_replace("g","g",$str); $str = str_replace("ģ","gj",$str); $str = str_replace("h","h",$str); $str = str_replace("i","i",$str); $str = str_replace("ī","ii",$str); $str = str_replace("j","j",$str); $str = str_replace("k","k",$str); $str = str_replace("ķ","kj",$str); $str = str_replace("l","l",$str); $str = str_replace("ļ","lj",$str); $str = str_replace("n","n",$str); $str = str_replace("ņ","nj",$str); $str = str_replace("o","o",$str); $str = str_replace("p","p",$str); $str = str_replace("r","r",$str); $str = str_replace("s","s",$str); $str = str_replace("š","sh",$str); $str = str_replace("t","t",$str); $str = str_replace("u","u",$str); $str = str_replace("ū","uu",$str); $str = str_replace("v","v",$str); $str = str_replace("z","z",$str); $str = str_replace("ž","zh",$str); $str = str_replace("A","A",$str); $str = str_replace("Ā","AA",$str); $str = str_replace("B","B",$str); $str = str_replace("C","C",$str); $str = str_replace("Č","CH",$str); $str = str_replace("D","D",$str); $str = str_replace("E","E",$str); $str = str_replace("Ē","EE",$str); $str = str_replace("F","F",$str); $str = str_replace("G","G",$str); $str = str_replace("Ģ","GJ",$str); $str = str_replace("H","H",$str); $str = str_replace("I","I",$str); $str = str_replace("Ī","II",$str); $str = str_replace("J","J",$str); $str = str_replace("K","K",$str); $str = str_replace("Ķ","KJ",$str); $str = str_replace("L","L",$str); $str = str_replace("Ļ","LJ",$str); $str = str_replace("M","M",$str); $str = str_replace("N","N",$str); $str = str_replace("Ņ","NJ",$str); $str = str_replace("O","O",$str); $str = str_replace("P","P",$str); $str = str_replace("R","R",$str); $str = str_replace("S","S",$str); $str = str_replace("Š","SH",$str); $str = str_replace("T","T",$str); $str = str_replace("U","U",$str); $str = str_replace("Ū","UU",$str); $str = str_replace("V","V",$str); $str = str_replace("Z","Z",$str); $str = str_replace("Ž","ZH",$str); return $str; } function win_to_utf($str) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'utf-8', 'windows-1251');if (function_exists('iconv')) return iconv('windows-1251', 'utf-8', $str); $win1251utf8 = array( "\A"=>"А","\0x0100"=>"Ā","\B"=>"B","\C"=>"C","\0x010C"=>"Č","\D"=>"D","\E"=>"E","\0x0112"=>"Ē","\F"=>"F","\G"=>"G","\0x0122"=>"Ģ","\H"=>"H","\I"=>"I","\0x012A"=>"Ī","\J"=>"J","\K"=>"K","\0x0136"=>"Ķ","\L"=>"L","\0x013B"=>"Ļ","\M"=>"M","\N"=>"N","\0x0145"=>"Ņ","\O"=>"0","\P"=>"P","\R"=>"R","\S"=>"S","\0x0160"=>"Š","\T"=>"T","\U"=>"U","\0x016A"=>"Ū","\V"=>"V","\Z"=>"Z","\0x017D"=>"Ž","\a"=>"a","\0x0101"=>"ā","\b"=>"b","\c"=>"c","\0x010D"=>"č","\d"=>"d","\e"=>"e","\0x0113"=>"ē","\f"=>"f","\g"=>"g","\0x01E7"=>"ģ","\h"=>"h","\i"=>"i","\0x012B"=>"ī","\j"=>"j","\k"=>"k","\0x0137"=>"ķ","\l"=>"l","\0x013C"=>"ļ","\m"=>"n","\0x0146"=>"ņ","\o"=>"o","\p"=>"p","\r"=>"r","\s"=>"s","\0x0161"=>"š","\t"=>"t","\u"=>"u","\0x016B"=>"ū","\v"=>"v","\z"=>"z","\0x017E"=>"ž", //"\xC0"=>"А","\xC1"=>"Б","\xC2"=>"В","\xC3"=>"Г","\xC4"=>"Д","\xC5"=>"Е","\xA8"=>"Ё","\xC6"=>"Ж","\xC7"=>"З","\xC8"=>"И","\xC9"=>"Й","\xCA"=>"К","\xCB"=>"Л","\xCC"=>"М",//"\xCD"=>"Н","\xCE"=>"О","\xCF"=>"П","\xD0"=>"Р","\xD1"=>"С","\xD2"=>"Т","\xD3"=>"У","\xD4"=>"Ф","\xD5"=>"Х","\xD6"=>"Ц","\xD7"=>"Ч","\xD8"=>"Ш","\xD9"=>"Щ","\xDA"=>"Ъ",//"\xDB"=>"Ы","\xDC"=>"Ь","\xDD"=>"Э","\xDE"=>"Ю","\xDF"=>"Я","\xE0"=>"а","\xE1"=>"б","\xE2"=>"в","\xE3"=>"г","\xE4"=>"д","\xE5"=>"е","\xB8"=>"ё","\xE6"=>"ж","\xE7"=>"з",//"\xE8"=>"и","\xE9"=>"й","\xEA"=>"к","\xEB"=>"л","\xEC"=>"м","\xED"=>"н","\xEE"=>"о","\xEF"=>"п","\xF0"=>"р","\xF1"=>"с","\xF2"=>"т","\xF3"=>"у","\xF4"=>"ф","\xF5"=>"х",//"\xF6"=>"ц","\xF7"=>"ч","\xF8"=>"ш","\xF9"=>"щ","\xFA"=>"ъ","\xFB"=>"ы","\xFC"=>"ь","\xFD"=>"э","\xFE"=>"ю","\xFF"=>"я"); return strtr($str, $win1251utf8); } function utf_to_win($str) { if (function_exists('mb_convert_encoding')) return mb_convert_encoding($str, 'windows-1251', 'utf-8');if (function_exists('iconv')) return iconv('utf-8', 'windows-1251', $str); $utf8win1251 = array( "A"=>"\A","Ā"=>"\0x0100","B"=>"\B","C"=>"\C","Č"=>"\0x010C","D"=>"\D","E"=>"\E","Ē"=>"\0x0112","F"=>"\F","G"=>"\G","Ģ"=>"\0x0122","H"=>"\H","I"=>"\I","Ī"=>"\0x012A","J"=>"\J","K"=>"\K","Ķ"=>"\0x0136","L"=>"\L","Ļ"=>"\0x013B","M"=>"\M","N"=>"\N","Ņ"=>"\0x0145","O"=>"\O","P"=>"\P","R"=>"\R","S"=>"\S","Š"=>"\0x0160","T"=>"\T","U"=>"\U","Ū"=>"\0x016B","V"=>"\V","Z"=>"\Z","Ž"=>"\0x017D","a"=>"\a","ā"=>"\0x0101","b"=>"\b","c"=>"\c","č"=>"\0x010D","d"=>"\d","e"=>"\e","ē"=>"\0x0113","f"=>"\f","g"=>"\g","ģ"=>"\0x01E7","h"=>"\h","i"=>"\i","ī"=>"\0x012B","j"=>"\j","k"=>"\k","ķ"=>"\0x0137","l"=>"\l","ļ"=>"\0x013C","m"=>"\m","n"=>"\n","ņ"=>"\0x0146","o"=>"\o","p"=>"\p","r"=>"\r","s"=>"\s","š"=>"\0x0161","t"=>"\t","u"=>"\u","ū"=>"\0x016B","v"=>"\v","z"=>"\z","ž"=>"\0x017E", //"А"=>"\xC0","Б"=>"\xC1","В"=>"\xC2","Г"=>"\xC3","Д"=>"\xC4","Е"=>"\xC5","Ё"=>"\xA8","Ж"=>"\xC6","З"=>"\xC7","И"=>"\xC8","Й"=>"\xC9","К"=>"\xCA","Л"=>"\xCB","М"=>"\xCC",//"Н"=>"\xCD","О"=>"\xCE","П"=>"\xCF","Р"=>"\xD0","С"=>"\xD1","Т"=>"\xD2","У"=>"\xD3","Ф"=>"\xD4","Х"=>"\xD5","Ц"=>"\xD6","Ч"=>"\xD7","Ш"=>"\xD8","Щ"=>"\xD9","Ъ"=>"\xDA",//"Ы"=>"\xDB","Ь"=>"\xDC","Э"=>"\xDD","Ю"=>"\xDE","Я"=>"\xDF","а"=>"\xE0","б"=>"\xE1","в"=>"\xE2","г"=>"\xE3","д"=>"\xE4","е"=>"\xE5","ё"=>"\xB8","ж"=>"\xE6","з"=>"\xE7",//"и"=>"\xE8","й"=>"\xE9","к"=>"\xEA","л"=>"\xEB","м"=>"\xEC","н"=>"\xED","о"=>"\xEE","п"=>"\xEF","р"=>"\xF0","с"=>"\xF1","т"=>"\xF2","у"=>"\xF3","ф"=>"\xF4","х"=>"\xF5",//"ц"=>"\xF6","ч"=>"\xF7","ш"=>"\xF8","щ"=>"\xF9","ъ"=>"\xFA","ы"=>"\xFB","ь"=>"\xFC","э"=>"\xFD","ю"=>"\xFE","я"=>"\xFF"); return strtr($str, $utf8win1251); } function trun_to_rus($str) {$str=str_replace("AA","Ā",$str);$str=str_replace("aa","ā",$str); $str=str_replace("CH","Č",$str); $str=str_replace("ch","č",$str);$str=str_replace("EE","Ē",$str);$str=str_replace("ee","ē",$str);$str=str_replace("GJ","Ģ",$str);$str=str_replace("gj","ģ",$str);$str=str_replace("II","Ī",$str); $str=str_replace("ii","ī",$str); $str=str_replace("KJ","Ķ",$str); $str=str_replace("kj","ķ",$str);$str=str_replace("LJ","Ļ",$str);$str=str_replace("lj","ļ",$str);$str=str_replace("NJ","Ņ",$str);$str=str_replace("nj","ņ",$str);$str=str_replace("SH","Š",$str);$str=str_replace("sh","š",$str);$str=str_replace("UU","Ū",$str);$str=str_replace("uu","ū",$str);$str=str_replace("ZH","Ž",$str);$str=str_replace("zh","ž",$str);$str=strtr($str,array("a"=>"a", "aa"=>"ā", "b"=>"b", "c"=>"c", "ch"=>"č", "d"=>"d", "e"=>"e", "ee"=>"ē", "f"=>"f", "g"=>"g", "gj"=>"ģ", "h"=>"h", "i"=>"i", "ii"=>"ī", "j"=>"j", "k"=>"k", "kj"=>"ķ", "l"=>"l", "lj"=>"ļ", "m"=>"m", "n"=>"n", "nj"=>"ņ", "o"=>"o", "p"=>"p", "r"=>"r", "s"=>"s", "sh"=>"š", "t"=>"t", "u"=>"u", "uu"=>"ū", "v"=>"v", "z"=>"z", "zh"=>"ž", "A"=>"A", "AA"=>"Ā", "B"=>"B", "C"=>"C", "CH"=>"Č", "D"=>"D", "E"=>"E", "EE"=>"Ē", "F"=>"F", "G"=>"G", "GJ"=>"Ģ", "H"=>"H", "I"=>"I", "II"=>"Ī", "J"=>"J", "K"=>"K", "KJ"=>"Ķ", "L"=>"L", "LJ"=>"Ļ", "M"=>"M", "N"=>"N", "NJ"=>"Ņ", "O"=>"O", "P"=>"P", "R"=>"R", "S"=>"S", "SH"=>"Š", "T"=>"T", "U"=>"U", "UU"=>"Ū", "V"=>"V", "Z"=>"Z", "ZH"=>"Ž"));return $str;} function check($message) {$message=str_replace("|","I",$message);$message=str_replace("||","I",$message);$message=htmlspecialchars($message);$message = str_replace("\r\n", "<br/>", $message);$message = strtr($message, array(chr("1") => "", chr("2") => "", chr("3") => "", chr("4") => "", chr("5") => "", chr("6") => "", chr("7") => "", chr("8") => "", chr("9") => "", chr("10") => "", chr("11") => "", chr("12") => "", chr ("13") => "", chr("14") => "", chr("15") => "", chr("16") => "", chr("17") => "", chr("18") => "", chr("19") => "", chr("20") => "", chr("21") => "", chr("22") => "", chr("23") => "", chr("24") => "", chr("25") => "", chr("26") => "", chr("27") => "", chr("28") => "", chr("29") => "", chr("30") => "", chr("31") => ""));$message = iconv('utf-8', 'windows-1251', $message);$message = substr($message, 0, 1000);$message = iconv('windows-1251', 'utf-8', $message);$message=str_replace("'","'",$message);$message=str_replace("\"",""",$message);$message=str_replace("\$","$",$message);$message=str_replace("$","$",$message);$message=str_replace("\\","\", $message);$message=str_replace("`","`", $message);$message=str_replace("^","^", $message);$message=str_replace("%","%", $message);$message=str_replace(":",":",$message);$message=preg_replace("|:|",":",$message,3);$message=stripslashes(trim($message));return $message;} function replace_rus($str) { $str = str_replace("a","|",$str); $str = str_replace("ā","|",$str); $str = str_replace("b","|",$str); $str = str_replace("c","|",$str); $str = str_replace("č","|",$str); $str = str_replace("d","|",$str); $str = str_replace("e","|",$str); $str = str_replace("ē","|",$str); $str = str_replace("f","|",$str); $str = str_replace("g","|",$str); $str = str_replace("ģ","|",$str); $str = str_replace("h","|",$str); $str = str_replace("i","|",$str); $str = str_replace("ī","|",$str); $str = str_replace("j","|",$str); $str = str_replace("k","|",$str); $str = str_replace("ķ","|",$str); $str = str_replace("l","|",$str); $str = str_replace("ļ","|",$str); $str = str_replace("n","|",$str); $str = str_replace("ņ","|",$str); $str = str_replace("o","|",$str); $str = str_replace("p","|",$str); $str = str_replace("r","|",$str); $str = str_replace("s","|",$str); $str = str_replace("š","|",$str); $str = str_replace("t","|",$str); $str = str_replace("u","|",$str); $str = str_replace("ū","|",$str); $str = str_replace("v","|",$str); $str = str_replace("z","|",$str); $str = str_replace("ž","|",$str); $str = str_replace("A","|",$str); $str = str_replace("Ā","|",$str); $str = str_replace("B","|",$str); $str = str_replace("C","|",$str); $str = str_replace("Č","|",$str); $str = str_replace("D","|",$str); $str = str_replace("E","|",$str); $str = str_replace("Ē","|",$str); $str = str_replace("F","|",$str); $str = str_replace("G","|",$str); $str = str_replace("Ģ","|",$str); $str = str_replace("H","|",$str); $str = str_replace("I","|",$str); $str = str_replace("Ī","|",$str); $str = str_replace("J","|",$str); $str = str_replace("K","|",$str); $str = str_replace("Ķ","|",$str); $str = str_replace("L","|",$str); $str = str_replace("Ļ","|",$str); $str = str_replace("M","|",$str); $str = str_replace("N","|",$str); $str = str_replace("Ņ","|",$str); $str = str_replace("O","|",$str); $str = str_replace("P","|",$str); $str = str_replace("R","|",$str); $str = str_replace("S","|",$str); $str = str_replace("Š","|",$str); $str = str_replace("T","|",$str); $str = str_replace("U","|",$str); $str = str_replace("Ū","|",$str); $str = str_replace("V","|",$str); $str = str_replace("Z","|",$str); $str = str_replace("Ž","|",$str); return $str; } Edited September 4, 2010 by ppc Quote Link to comment Share on other sites More sharing options...
marrtins Posted September 4, 2010 Report Share Posted September 4, 2010 Ceri vien, ka kāds to drazu pa velti debugos :D Quote Link to comment Share on other sites More sharing options...
ppc Posted September 4, 2010 Author Report Share Posted September 4, 2010 Ceri vien, ka kāds to drazu pa velti debugos :D Cik tad tu gurdiniek prasi? :D Quote Link to comment Share on other sites More sharing options...
briedis Posted September 4, 2010 Report Share Posted September 4, 2010 Kas īsti nestrādā? Vai ir kāds kļūdas paziņojums? Vai ir ieslēgts error reportings? Kā ieslēgt, te: http://www.bradino.com/php/error-reporting/ Quote Link to comment Share on other sites More sharing options...
codez Posted September 4, 2010 Report Share Posted September 4, 2010 Tur ir jālabo viss. Kad skatos uz šādiem kodiem, liekas, ka tie mēģina pārdefinēt jēdzienu "programmēšana". Quote Link to comment Share on other sites More sharing options...
ppc Posted September 4, 2010 Author Report Share Posted September 4, 2010 Kas īsti nestrādā? Vai ir kāds kļūdas paziņojums? Vai ir ieslēgts error reportings? Kā ieslēgt, te: http://www.bradino.com/php/error-reporting/ Nestrādā tas kad aizkomentēju rus rindas un atkomentēju lv, rādās balta lapa mājaslapā. php_flag error_reporting 1 ir hataccessā un inc.php ir aizkomentētas "//" arī šīs divas rindiņas: Error_Reporting(E_ALL & ~E_NOTICE); Error_Reporting (ERROR | WARNING); Bet neko neuzrāda. Quote Link to comment Share on other sites More sharing options...
briedis Posted September 4, 2010 Report Share Posted September 4, 2010 Pievienoji koda augšpusē šīs divas rindiņas? ini_set('display_errors',1); error_reporting(E_ALL); Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted September 5, 2010 Report Share Posted September 5, 2010 1. str_replace lieliski apstraada arii masiivus, attieciigi ir pastuulbi vienaa f-ja vinju atkartot N-tas reizes tatad atieciigi pirmaa f-ja ir galiigi garam, pietiktu ar masiivu un vinjm padot ttieciigo msiivu. Kuru personiigi glabatu atseviskjaa fila (lai prskatamaaks kods, un vieglak varetu veikt labojumus) piedevam attieciigo failu saglabat jau vajadzigaja kodejumaa.. 2. kada jega replaisot no 'a' uz 'a' ? , rus varjantaa (vel sprastu) bet ta ka RU nav 'z' tad 'z' replisosana ir pilniigi lieka. 3. izmanto str_replace() vieta str_ireplace() -> lai stradatu ar UTF-8 Quote Link to comment Share on other sites More sharing options...
ppc Posted September 7, 2010 Author Report Share Posted September 7, 2010 1. str_replace lieliski apstraada arii masiivus, attieciigi ir pastuulbi vienaa f-ja vinju atkartot N-tas reizes tatad atieciigi pirmaa f-ja ir galiigi garam, pietiktu ar masiivu un vinjm padot ttieciigo msiivu. Kuru personiigi glabatu atseviskjaa fila (lai prskatamaaks kods, un vieglak varetu veikt labojumus) piedevam attieciigo failu saglabat jau vajadzigaja kodejumaa.. 2. kada jega replaisot no 'a' uz 'a' ? , rus varjantaa (vel sprastu) bet ta ka RU nav 'z' tad 'z' replisosana ir pilniigi lieka. 3. izmanto str_replace() vieta str_ireplace() -> lai stradatu ar UTF-8 Paldies bet tiku galā, vnk no iepriekšējā čata varianta ieliku tranlate kodus un miers. Quote Link to comment 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.