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 Quote Link to comment 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"> Quote Link to comment 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 ? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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 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.