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
https://forums.phpfreaks.com/topic/174431-solved-problem-parsing-file/
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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.