techcone Posted May 17, 2009 Share Posted May 17, 2009 Hello freaks Here is my small problem, I have a text file in which some text in israel language is written, what I do is pick the contents for the file and post it on a site using curl. Somehow, it is not posting it and showing gibberish characters. Can please any one throw some light how to read the text file correctly in a string and how to encode it so that the text which is send correctly passed to the site ? Thanks Link to comment https://forums.phpfreaks.com/topic/158503-problem-with-text-file-in-other-language/ Share on other sites More sharing options...
Masna Posted May 17, 2009 Share Posted May 17, 2009 $file = mb_convert_encoding(file_get_contents("file.txt"), "ISO-8859-8"); Don't forget to include the following in the <head> tags of the HTML document you're attempting to display said text in: <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8"> Link to comment https://forums.phpfreaks.com/topic/158503-problem-with-text-file-in-other-language/#findComment-835942 Share on other sites More sharing options...
techcone Posted May 18, 2009 Author Share Posted May 18, 2009 Can i send contents of $file to curl too, without any encoding function ? Link to comment https://forums.phpfreaks.com/topic/158503-problem-with-text-file-in-other-language/#findComment-836232 Share on other sites More sharing options...
Masna Posted May 18, 2009 Share Posted May 18, 2009 Well I guess you would have to encode it before writing, then write. EDIT: Actually, don't quote me on this. I'm not sure, to be honest. Try writing without encoding, and see if things go according to plan. Link to comment https://forums.phpfreaks.com/topic/158503-problem-with-text-file-in-other-language/#findComment-836233 Share on other sites More sharing options...
techcone Posted May 18, 2009 Author Share Posted May 18, 2009 Well, I will try and report you back mate Link to comment https://forums.phpfreaks.com/topic/158503-problem-with-text-file-in-other-language/#findComment-836238 Share on other sites More sharing options...
techcone Posted May 20, 2009 Author Share Posted May 20, 2009 $messagetext = mb_convert_encoding(file_get_contents('message.txt'), 'HTML-ENTITIES', "UTF-8"); This solved my problem Link to comment https://forums.phpfreaks.com/topic/158503-problem-with-text-file-in-other-language/#findComment-837957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.