goma smile Posted March 7, 2010 Report Share Posted March 7, 2010 Sveiki, Man ir tā ka man datubazē ir ieraksti ISO-8859-1 čarseta stila (~20000). Es velos zināt var tak kaut ka parvērst ISO-8859-1 uz utf-8, vienkārši teksts kas ir ISO-8859-1 ir izvarots. A patejais ir utf-8 kur viss ir oky :) Quote Link to comment Share on other sites More sharing options...
2easy Posted March 7, 2010 Report Share Posted March 7, 2010 mb_convert_encoding() Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 7, 2010 Author Report Share Posted March 7, 2010 <? $db_host = 'localhost'; $db_user = 'root'; $db_password = ''; $db_name = '2pac'; $connection = mysql_connect($db_host, $db_user, $db_password) or die(mysql_error()); mysql_select_db($db_name, $connection); $res = mysql_query("SELECT * FROM forums_posts"); while ($r = mysql_fetch_array($res)){ $sql = "UPDATES identy_forums_posts SET post_message='". mb_convert_encoding($r['post_message'], "UTF-8", "ISO-8859-1")."' WHERE post_id='".$r['post_id']."'"; mysql_query($sql) OR DIE(mysql_error()); } ?> Ar šito izvadot echo mb_convert_encoding($r['post_message'], "UTF-8", "ISO-8859-1"); izvadās ArrayArrayArray (~20000). Quote Link to comment Share on other sites More sharing options...
daGrevis Posted March 7, 2010 Report Share Posted March 7, 2010 http://php.net/manual/en/function.mb-convert-encoding.php Quote Link to comment Share on other sites More sharing options...
2easy Posted March 7, 2010 Report Share Posted March 7, 2010 (edited) nu ja datos ir "ArrayArrayArray", tad tā arī izvadās. ko tur brīnīties ;) btw, gadījumā tev tur nav latviešu burti? tad tas ir windows-1257 kodējums. vnk šobrīd lv simboli tiek glabāti nepareizā kodējumā iso-8859-1, bet jākonvertē taču ir no tāda kodējuma, kādā ir dati!!! vispār, ja tev operētājsistēmā šobrīd tiek izmantots windows-1257 kodējums, tad vnk atver exportēto sql failu un saglabā kā utf-8. un visa konvertācija būs gatava ;) Edited March 7, 2010 by 2easy Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 7, 2010 Author Report Share Posted March 7, 2010 Vienkārši pirms gada viens 4alis instalēja ipb .... forumu un tagad gandrīz esu pabeidzis savu forumu un tur izmantojot vecos topikus metās 4eburi.., un man negribās vecos pazaudēt. Quote Link to comment Share on other sites More sharing options...
2easy Posted March 7, 2010 Report Share Posted March 7, 2010 tas ir vienkārši, ja saprot, ko dara :D Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 8, 2010 Author Report Share Posted March 8, 2010 Warning: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in C:\AppServ\www\ss.php on line 18 Kad uzliek windows-1257 tad vairs nav tas ArrayArrayArray (~20000). bet gan Illegal character encoding specifie Quote Link to comment Share on other sites More sharing options...
foxsk8 Posted March 8, 2010 Report Share Posted March 8, 2010 (edited) Nu tur var uzrakstīt skriptu priekš tā visa, lai windows-1257 un iso kodējumus pārvērstu normālos simbolos. Ja interesē raksti PM, pašam ir priekš phpbb foruma šāds fixs izveidots. Respektīvi, uztaisam sql dump, iemetam skriptā sql faila nosaukumu un palaižam, skripts izdod ārā gatavu sql, kuru tik atliek atkal pa jaunu importēt. Pēc tam uzsetojam attiecīgos collotation priekš datubāzes un priekš konekcijas uzmetam attiecīgi @mysql_query("SET NAMES utf8"); Edited March 8, 2010 by foxsk8 Quote Link to comment Share on other sites More sharing options...
xPtv45z Posted March 8, 2010 Report Share Posted March 8, 2010 Tāpēc, ka tur nav jāraksta windows-1257, bet gan ISO-8859-13 Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 8, 2010 Author Report Share Posted March 8, 2010 Es esu izprovējis 100 variantus un nekā nesanāk ...., Moš ir kāda speciāla funkcija... Quote Link to comment Share on other sites More sharing options...
2easy Posted March 8, 2010 Report Share Posted March 8, 2010 var repleisot pa baitam. tu foxsk8 paprasīji to skriptu? Quote Link to comment Share on other sites More sharing options...
goma smile Posted March 8, 2010 Author Report Share Posted March 8, 2010 (edited) Viņā dotais novērsa daļu, proti izlaboja daļu bet daļa vel ir Viņs pārtaisja Sveiki mani d ā ; rgie draugi, m ī ; ļ ;otāji, fanāti - Pūkainie un ne tik pūkainie. Sveiki mani dārgie draugi, mīļotāji, fanāti - Pūkainie un ne tik pūkainie. Bet daļa vel ir palikusi maÅ¡Ä«na labi sanÄca, un vÄ“l man patÄ«k 3. darbs Edited March 8, 2010 by goma smile Quote Link to comment Share on other sites More sharing options...
2easy Posted March 8, 2010 Report Share Posted March 8, 2010 tad ņem to skriptu par paraugu un papildini, lai tas norepleiso to, kas vēl nav norepleisojies. lv mīkstinājumu zīmes taču nav tik daudz! 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.