Jump to content

[SOLVED] Problem Parsing File


N-Bomb(Nerd)

Recommended Posts

I'm trying to parse a txt file and there' some unicode in there. I'm trying to use a preg_match_all to get some content within the file; using the unicode to select which points I want.

 

I'm having some trouble with the character though.. at first it was working pretty well... then it just stopped working.

 

I'm trying to find the character "ô" within the file. However, when I echo the contents of the file in my browser it shows as a question mark on a diamond.

 

I've been up the last 4.5 hours trying to figure this out.  :'(

 

How the hell would I use that character in my preg_match_all?

 

File I'm trying to parse:

ChrisôM4A1ô(randomstuff)

MikeôAK-47ô(randomstuff)

 

I tried doing:

preg_match_all('~(.*)ô(.*)ô~i', $content, $matches);

 

Didn't work though.. and what really gets me is that the above line worked for a few hours.. then magically stopped working.  :wtf:

Link to comment
Share on other sites

I'm trying to find the character "ô" within the file. However, when I echo the contents of the file in my browser it shows as a question mark on a diamond.

 

you have your doctype set wrong

 

Anyways i would  str_replace the character with another like a pipe | before matching it

Link to comment
Share on other sites

I'm trying to find the character "ô" within the file. However, when I echo the contents of the file in my browser it shows as a question mark on a diamond.

 

you have your doctype set wrong

 

Anyways i would  str_replace the character with another like a pipe | before matching it

 

What would be the correct doctype to set then?

 

Also, I just tried to do a str_replace on the character and that didn't do anything either.

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.