bublik Posted March 21, 2007 Report Share Posted March 21, 2007 Ka es varu tekstu kura ir burti ar garumzimem parkonvertet ta lai visas garumzimes tiktu aizstatas ar parastu burtu ā ==> a, č ==> c utt... Link to comment Share on other sites More sharing options...
andrisp Posted March 21, 2007 Report Share Posted March 21, 2007 (edited) php.net/strreplace un divi masīvi. Vienā, ko vajag aizstāt, otrā - kas jāaizstāj. Edited March 21, 2007 by andrisp Link to comment Share on other sites More sharing options...
bublik Posted March 21, 2007 Author Report Share Posted March 21, 2007 $find = array("Ā","Ē","Ū","Ī","Š","Ģ","Ķ","Ļ","Ž","Č","Ņ","ā","ē","ū","ī","š","ģ","ķ","ļ","ž","č","ņ"); $replace = array("A","E","U","I","S","G","K","L","Z","C","N","a","e","u","i","s","g","k","l","z","c","n"); $text=str_ireplace($find,$replace,$text); Vai ir pareizi uzrakstits ? jo vins isti nestrada? Link to comment Share on other sites More sharing options...
blackhalt Posted March 21, 2007 Report Share Posted March 21, 2007 nepareizi, vajag str_replace Link to comment Share on other sites More sharing options...
andrisp Posted March 21, 2007 Report Share Posted March 21, 2007 str_ireplace ir pieejams tikai no php 5. versijas. Domāju, ka tur tev tā problēma. Bet citā visā citā ziņā kods ir pareizs un strādā. Izmanto parasto str_replace. Link to comment Share on other sites More sharing options...
bublik Posted March 22, 2007 Author Report Share Posted March 22, 2007 Tagad vins strada, bet ir velviena problema... vins tekstu kuru parveidot nem no MySql tabulas kodejums - (utf8_general_ci), un ja es tagad izveidoju $find = array("Ā","Ē","Ū","Ī","Š","Ģ","Ķ","Ļ","Ž","Č","Ņ","ā","ē","ū","ī","š","ģ","ķ","ļ","ž","č","ņ"); $replace = array("A","E","U","I","S","G","K","L","Z","C","N","a","e","u","i","s","g","k","l","z","c","n"); $text=str_place($find,$replace,$text); Un vins neatpazist si kodejuma garumzimes , un nenomaina tas! Vai ir kadi ieteikumi ?? Link to comment Share on other sites More sharing options...
andrisp Posted March 22, 2007 Report Share Posted March 22, 2007 Pieseivo pašu skriptu arī utf-8 kodējumā. Link to comment Share on other sites More sharing options...
bublik Posted March 22, 2007 Author Report Share Posted March 22, 2007 Ta es nevaru, jo tas ir viens no daudzajiem inkludiem, un tad ja es vinu saglabaju utf-8 tad visa sistema nobruk ! Nav citu risinajumu ?? Link to comment Share on other sites More sharing options...
v3rb0 Posted March 22, 2007 Report Share Posted March 22, 2007 iconv Link to comment Share on other sites More sharing options...
andrisp Posted March 22, 2007 Report Share Posted March 22, 2007 Kā nobrūk ? Enīvei, ja tev ir svarīgi, lai viss pārējais skripts paliek ANSI, tad vari tos divus masīvos ievietot atsevišķā failā, ko pieseivo kā utf-8, un iekļauj iekš tā faila, kur reāli vajag to aizvietošanu. Un failu pieseivo utf-8 bez DOM. Var arī tos masīvus pirms izmantošanas izlaist caur iconv un pārkonvertēt uz utf-8. Link to comment Share on other sites More sharing options...
ray Posted March 23, 2007 Report Share Posted March 23, 2007 (edited) Enīvei, ja tev ir svarīgi, lai viss pārējais skripts paliek ANSI, tad vari tos divus masīvos ievietot atsevišķā failā, ko pieseivo kā utf-8, un iekļauj iekš tā faila, kur reāli vajag to aizvietošanu. Un failu pieseivo utf-8 bez DOM. ko tas DOM dod/nedod? Edited March 23, 2007 by ray Link to comment Share on other sites More sharing options...
andrisp Posted March 23, 2007 Report Share Posted March 23, 2007 Vispār jau es pārteicos - bija domāts BOM jeb Byte Order Mask. Tā ir tāda fiška, kas vajadzīga specifiskiem Unicode formātiem (piem., UTF-16, UTF-32 u.c., ja nemaldos), lai tie pareizi strādātu. Nepateikšu gan īsti, ko viņs dara, jo nezinu :). Bet katrā ziņā zinu, ka UTF-8 formātam tas BOM nav vajadzīgs. Reāli BOM ir daži "neredzami" simboli faila sākumā. Un viņi parasti traucē, jo browseri nez kāpēc nemāk ar viņiem appieties. Tas sajauc tiem galvu. Tāpēc to vajag izravēt. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted March 23, 2007 Report Share Posted March 23, 2007 tie ir 3 simboli faila sakuma kas noraada ka tas ir UTF-8 .. prieks Weba tie nav vajadziigi (tos izmantod dazji teksta redaktori utt...) Link to comment Share on other sites More sharing options...
jogin Posted April 13, 2007 Report Share Posted April 13, 2007 laikam jaiemet links uz savu postu - izskataas, ka arii te paliidzees http://php.lv/f/index.php?act=findpost&pid=57625 Link to comment Share on other sites More sharing options...
Recommended Posts