Re: Char encoding using fget or curl

From: Date: Fri, 22 Jul 2005 08:39:39 +0000
Subject: Re: Char encoding using fget or curl
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-219202@lists.php.net to get a copy of this message
On Mon, July 18, 2005 2:14 pm, Marcelo Volmaro said: > I need to get some information from a webpage, that is served as UTF-8. > I need that information because the page contains different language > characters. The problem is that no matter if I use fget or the CURL > libraries, i got the information in ISO-8859-1. > How can i overcome this? Take in consideration that not all UTF-8 can be > converted to ISO-8859-1 (chinese, for example) WILD GUESSES!!! There might be a CURLOPT_CHARSET or similar constant that is not documented on php.net, and that might not have made it into PHP as a constant even, but if you read the original curl docs will tell you how to do it... You might have to do something like: if (!defined('CURLOPT_CHARSET')) define('CURLOPT_CHARSET', 47); just to have the constant available. It's also entirely possible that curl, by default, sends some kind of default "Accepts: charset=ISO-8859-1" header or something similar, and you just need to send some *other* header to tell the web-server that your browser "understands" UTF-8. Or maybe even that you specifically want the results in Chinese or whatever... I know a lot of webservers/browsers don't implement the language-preference for the browser/user, but *MAYBE* it will have some effect. Just some ideas from a guy who knows he's WAY too stupid to ever have multi-lingual anything working on his own web-site. :-) -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#219202) next »