curl-and-php
Re: Special characters and UTF-8
Date: Mon, 3 Dec 2007 07:56:37 -0500
I've had the same experience. I strip them out...
// Return false if entended ascii characters are found
for( $i=0;$i < strlen($textstr);$i++ ){
$n = ord(substr($textstr,$i,1));
if($n < 32 || $n > 127){
if($n == 160){
$textstr = str_replace(chr(160),"",$textstr);
}else{
return false;
}
}
}
Richard
On Fri, 30 Nov 2007 19:30:33 +0000
Ralph Seward <rj_seward_at_hotmail.com> wrote:
> Dear Folks:
>
> I have been searching various posts on this subject and have yet to find a solution, so...
>
> First, I am running an IMac with OS X 10.4.11. After retrieving text from a web page with Curl/PHP, certain characters are replaced by cryptic characters.
>
> For example:
>
> "I had a few teachers call me and ask what happened when I shut the stream down," said Steve. "I guess they really enjoyed it."
>
> becomes:
>
> ìI had a few teachers call me and ask what happened when I shut the stream down,î said Steve. ìI guess they really enjoyed it.î
>
> A copyright mark (© in html) becomes Æ, and a long dash becomes ó.
>
> After reading through the archived posts, I have come to the conclusion the problem is most likely in my system's support for UTF-8. Has anyone else out there run into a similar problem, and if so, what solution did you find, if any?
>
> Thanks in advance.
>
> Ralph
>
> _________________________________________________________________
> Put your friends on the big screen with Windows Vista® + Windows Live™.
> http://www.microsoft.com/windows/shop/specialoffers.mspx?ocid=TXT_TAGLM_CPC_MediaCtr_bigscreen_102007
-- Traceli Ltd 330B Walker Street Holly Hill, FL 32117 (386) 868-2068 _______________________________________________ http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-phpReceived on 2007-12-03