sandhya Posted June 2, 2009 Share Posted June 2, 2009 hi all, I have to read the content of text file and write here in working htm file. For this i'm using the following code. $myFile = "Friendship/friend.txt"; $fh = fopen($myFile, 'r'); $theData = fread($fh, filesize($myFile)); fclose($fh); echo $theData; But it reads and displays the content in the htm file like this. ��<�b�r�>�<�c�e�n�t�e�r�>�� �<�t�a�b�l�e� �c�e�l�l�s�p�a�c�i�n�g�=�"�0�"� �w�i�d�t�h�=�"�6�0�0�"� �h�e�i�g�h�t�=�"�4�0�0�"� �s�t�y�l�e�=�"�b�o�r�d�e�r�:�4�0�p�x� �s�o�l�i�d� �#�0�0�0�"�>�<�t�d� �b�g�c�o�l�o�r�=�"�0�"� �v�a�l�i�g�n�=�"�t�o�p�"� �a�l�i�g�n�=�"�c�e�n�t�e�r�"�>�<�h�r� �s�i�z�e�=�"�1�0�"� �s�t�y�l�e�=�"�b�o�r�d�e�r�:�1�2�p�x� �o�u�t�s�e�t� �#�D�7�7�D�8�2�"�>�<�b�r�>�<�b�r�>�� �<�i�m�g� �s�r�c�=�"�h�t�t� what are these symbols? how can i do it? I didn't gave full out put. Plz give me a solution. thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/ Share on other sites More sharing options...
Daniel0 Posted June 2, 2009 Share Posted June 2, 2009 Looks like an encoding issue. Try to use UTF-8. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847629 Share on other sites More sharing options...
sandhya Posted June 2, 2009 Author Share Posted June 2, 2009 i'm using same UTF-8 Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847631 Share on other sites More sharing options...
sandhya Posted June 2, 2009 Author Share Posted June 2, 2009 hi i'm using UTF-8 . But getting same problem. how can i solve it. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847647 Share on other sites More sharing options...
everisk Posted June 2, 2009 Share Posted June 2, 2009 How about echo html_entity_decode($theData); Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847651 Share on other sites More sharing options...
sandhya Posted June 2, 2009 Author Share Posted June 2, 2009 sorry it is also not working. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847659 Share on other sites More sharing options...
scvinodkumar Posted June 2, 2009 Share Posted June 2, 2009 could u post the file friend.txt here? Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847666 Share on other sites More sharing options...
sandhya Posted June 2, 2009 Author Share Posted June 2, 2009 ya sure here it is.. <br><center> <table cellspacing="0" width="600" height="400" style="border:40px solid #000"><td bgcolor="0" valign="top" align="center"><hr size="10" style="border:12px outset #D77D82"><br><br> <img src="http://lh5.ggpht.com/_ilb4DaDhZFA/SSspX_xmxNI/AAAAAAAABLs/6508KXHenTY/s800/remoteImage-99.png"width="530"> <a href="/Community.aspx?cmm=36189948"> <font face="Georgia" style="font-size:18px" color=E6A49D><br> <BR> "Maybe the best friendship are those where there is much discussion, much dispute and even so much affection." (George Eliot) <br> Be happy & keep smiling my friend! <img src=http://lh4.ggpht.com/__NkTUSIKIhA/SUAD2YyCOGI/AAAAAAAAA44/l2GjYzvp0UE/s800/406347qw4w1xy7y1.png> <hr><hr><font size=3> ★ Stylish Orkut Scraps ★™ <hr size="10" style="border:12px outset #D77D82"> this is basically orkut aplication based. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847670 Share on other sites More sharing options...
sandhya Posted June 2, 2009 Author Share Posted June 2, 2009 one more thing just tested in another system. there i find like this.. ��<br><center> <table cellspacing="0" width="600" height="400" style="border:40px solid #000"><td bgcolor="0" valign="top" align="center"><hr size="10" style="border:12px outset #D77D82"><br><br> <img src="http://lh5.ggpht.com/_ilb4DaDhZFA/SSspX_xmxNI/AAAAAAAABLs/6508KXHenTY/s800/remoteImage-99.png"width="530"> <a href="/Community.aspx?cmm=36189948"> <font face="Georgia" style="font-size:18px" color=E6A49D><br> <BR> "Maybe the best friendship are those where there is much discussion, much dispute and even so much affection." (George Eliot) <br> Be happy & keep smiling my friend! <img src=http://lh4.ggpht.com/__NkTUSIKIhA/SUAD2YyCOGI/AAAAAAAAA44/l2GjYzvp0UE/s800/406347qw4w1xy7y1.png> <hr><hr><font size=3> ★ Stylish Orkut Scraps ★™ <hr size="10" style="border:12px outset #D77D82"> why like this? Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847677 Share on other sites More sharing options...
scvinodkumar Posted June 2, 2009 Share Posted June 2, 2009 i save the text in text file and run it using php, it will displaying correctly for me Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-847690 Share on other sites More sharing options...
sandhya Posted June 3, 2009 Author Share Posted June 3, 2009 hi vinod thanks for u r reply. u r right that it works on some systems. here also i have tried in another systems also. for 4 systems its working on 1 system only. Its not working in another systems. and my os is Vista. and others are Windows XP. What could be the problem? Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-848370 Share on other sites More sharing options...
scvinodkumar Posted June 3, 2009 Share Posted June 3, 2009 Hi, i try on vista os, it displaying correctly. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-848374 Share on other sites More sharing options...
sandhya Posted June 3, 2009 Author Share Posted June 3, 2009 ok thank you. I"ll try it my self. thanks for your reply. Quote Link to comment https://forums.phpfreaks.com/topic/160614-copy-content-from-text-file-to-htm-file-using-php/#findComment-848378 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.