Jump to content

[SOLVED] char  problem


tomasd

Recommended Posts

hi,

I have a something strage going on here...

I'm doing web page dump with curl and then I remove html tags with $curl_data = strip_tags($curl_data);

If I then have echo $curl_data and run script on my console I'm getting an output with  characters, but if I run the script and send the output to file i.e. $php test.php > output there are no  characters.

Can somebody please tell me how to get rid of  in $curl_data? is there a function like strip_non_asci_tags? :)

Link to comment
Share on other sites

It appears that you're working with UTF-8.

Hey thanks for replying, the problem I'm having here is more with regex not recognising the char and not matching the string...

I guess fixing my regex would work just fine... how do I change $regex_arrive = "(\d{2}:\d{2}) Arrive"; to ignore  from "14:20 Arrive"?

Link to comment
Share on other sites

"Â " is the UTF-8 encoding for a "NO-BREAK SPACE." Perhaps you should decode the data first? See utf8_decode. You can also try using \p{Z} in place of the space in your regex.

thanks sorted;

      // curl data

      $curl_data = $curl_get;

      $curl_data = utf8_decode ($curl_data);

      $curl_data = strip_tags($curl_data);

then as for regex;

            $regex_depart = "(\d{2}:\d{2}).Depart";

            $regex_arrive = "(\d{2}:\d{2}).Arrive";

 

Thanks for your help!!!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.