cucumber Posted April 4, 2007 Report Share Posted April 4, 2007 (edited) Es genereju XML failu header ("Content-type: text/xml"); //header ("Content-Type: text/xml; charset=\"utf-8\""); $list = ""; $list .= "<"; $list .= "?"; $list .="xml version=\"1.0\" encoding=\"utf-8\""; //encoding=\"UTF-8\" //encoding=\"ISO-8859-1\" $list .= "?"; $list .= ">\n"; $list .="<abc>"; $valsyntax = array( "<", ">", "&", "'", "\"" ); $changesyntax= array( "<", ">", "&", "'", """ ); while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $key => $col_value) { $col_value = str_replace($valsyntax , $changesyntax, $col_value); if ( "komentari" == $key) $list .="<$key><![CDATA[ $col_value ]]></$key>\n"; //<![CDATA[\n \n]] else $list .="<$key>$col_value</$key>\n"; //<![CDATA[\n \n]] } } $list .="</abc>\n"; Problema ir tada, kad ir komentari krievu valoda, tad xml izment erroru "Cannot view XML input using XSL style sheet. Please correct the error ", kapec ta notiek? Edited April 4, 2007 by cucumber Link to comment Share on other sites More sharing options...
andrisp Posted April 4, 2007 Report Share Posted April 4, 2007 Īsti nezinu, bet varbūt headeri sūti vienkārši: header ("Content-Type: text/xml; charset=UTF-8"); Un varbūt arī, ka tev tajos krievīskajos komentāros ir kādi nenoeskeipotu characteri. Link to comment Share on other sites More sharing options...
cucumber Posted April 4, 2007 Author Report Share Posted April 4, 2007 (edited) Izveidoju testa failu ar extension xml, vienkarhsi ar IE meginu palaist ar rada erroru, bet ieksh FF krievu burtu viera rada melnus rombus ar jautajuma zimi ieksha? Varbut kods ir kreis, kur varbut vaina? <?xml version="1.0" encoding="UTF-8"?> <country id="Russia"> <title><![CDATA[Новосибирск]]></title> </country> !!! vaina bija faila formata bija ANSI, tomer error, kad genereju un radu pataisno lapa paliek aktuals? Edited April 4, 2007 by cucumber Link to comment Share on other sites More sharing options...
andrisp Posted April 4, 2007 Report Share Posted April 4, 2007 Pag tu taču saki, ka vainu atradi. Tev jau tikai viena vaina vien bija, kas tad vēl tur aktuāls ? Link to comment Share on other sites More sharing options...
cucumber Posted April 4, 2007 Author Report Share Posted April 4, 2007 Aktuals ir tas, ka talak uzgenereto xml failu ar php, vinsh to saglaba ka ansi kodejuma, ka var uztaisit ,lai utf-8. Php tapatas man rada to erroru, es sapratu kapec man vienkarshi uztaisot failu rada error. ps. pats php scripta fails ar ir ieksh utf-8 Link to comment Share on other sites More sharing options...
andrisp Posted April 4, 2007 Report Share Posted April 4, 2007 A dati vispār ir utf-8 ? Tie, kas no db nāk. PS. Pacenties izteikties sakarīgāk. Link to comment Share on other sites More sharing options...
cucumber Posted April 4, 2007 Author Report Share Posted April 4, 2007 (edited) Vini bija ieksh latin1_swedish_ci -> utf8_unicode_ci parliku Fails ir ieksh utf-8 formata atverot to ar notepad rada burtus pareizi atverot caur pspad to vieta radas keburi? Vai tas ka samainiju kodejumus kaut ko deva? Edited April 4, 2007 by cucumber Link to comment Share on other sites More sharing options...
andrisp Posted April 4, 2007 Report Share Posted April 4, 2007 Tu jau esi nomainījis tikai kolāciju (Tas kā dati tiek kārtoti un salīdzināti), ja nemaldos. Ja tie dati tiešām ir utf-8, tad izmanto SET NAMES utf8 pirms datu kverijošanas. Pamēģini tos krieviskos datus vienkārši outputot browserim (ne kā xml). Un paskaties vai tie rādas ok, kad browserim ieslēgts UTF-8. Link to comment Share on other sites More sharing options...
cucumber Posted April 4, 2007 Author Report Share Posted April 4, 2007 Es pamainiju utf8_unicode_ci -> latin1_swedish_ci atpakal. Izdariju ta, tagad nerada kludu, un ari burtus, tos ko neatpazist izvada ka geburus. Ka vareja no ta izvairities? Link to comment Share on other sites More sharing options...
andrisp Posted April 4, 2007 Report Share Posted April 4, 2007 Neko nesapratu, ko tu īsti izdarīji. Pamēģināji tekstu izdrukāt ne kā xml, bet vienkārši ? Link to comment Share on other sites More sharing options...
cucumber Posted April 4, 2007 Author Report Share Posted April 4, 2007 (edited) Es datu bazes struktura komentariem parliku encoding uz kadu bija nosakuma. Tad pieliku pirm querija SET NAMES utf8. Un izvadiju XML ara, tagad kludas nav vinsh izdruka XML, tikai tur kur bija krievu burti tagad ir geburi tadi kadi vini ir ieksh DB "Îáùèå". Tapec ka no tiem geburiem dabut normalus burtus.? ps. Ja es neizmantoju SET NAMES utf8 tad burti ir normlai, bet XML rada kludu. Edited April 4, 2007 by cucumber Link to comment Share on other sites More sharing options...
v3rb0 Posted April 4, 2007 Report Share Posted April 4, 2007 nu lab, varu vēlreiz, uzliec visur vienādu encodingu, un būs, nevis žēlojies ka tur viņam jābūt, viņš man nerāda utt. - viņš rāda tieši to, ko pats uztaisīji(ķeburus tāpēc, ka enkodingi aplami). Link to comment Share on other sites More sharing options...
cucumber Posted April 4, 2007 Author Report Share Posted April 4, 2007 (edited) Net tas ir pash saprotams ka viss stradas, bet tas nav mans variants, jo man ieksh myslq ir jau ieraksti ar tipu latin1_swedish_ci , man no viniem vajaga dabut uz XML farmatu . Varbut var kaut ka parconvertet? Edited April 4, 2007 by cucumber Link to comment Share on other sites More sharing options...
andrisp Posted April 4, 2007 Report Share Posted April 4, 2007 Izeksportē visus datus no db, ar kādu tūli pārkovertē uz utf-8 formātu. Piem., kaut vai ar notepad++ vai kādu citu editoru. Un eksportē atpakaļ. Tikai pirms tam paarliecinies, ka tajaa dampaa visi default charsets u.t.t (ja tādi ir) arī ir nomainīti uz vajadzīgo kodējumu. Link to comment Share on other sites More sharing options...
cucumber Posted April 11, 2007 Author Report Share Posted April 11, 2007 (edited) Kad es uztaisut exportu, un saglabaju faila vinam kodejums ir utf jau? Tabla ir latin1_swedish_ci no kodeta, biju visu parlicis ka bija teikt paris postus augstak, bet tas nedeva rezultaus. Ka es varu no tiem keburiem dabut kaut ko normalu? DROP TABLE IF EXISTS `t`; CREATE TABLE IF NOT EXISTS `t` ( `did` int(11) NOT NULL auto_increment, `ddescript` text NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1; INSERT INTO `documents` (`did`,`ddescript`) VALUES (2,'Îïèñà Ãèå ðóññêîé âåðñèè ñà éòÃ'); Edited April 11, 2007 by cucumber Link to comment Share on other sites More sharing options...
Recommended Posts