N-Bomb(Nerd) Posted September 16, 2009 Share Posted September 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/174431-solved-problem-parsing-file/ Share on other sites More sharing options...
dreamwest Posted September 16, 2009 Share Posted September 16, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/174431-solved-problem-parsing-file/#findComment-919376 Share on other sites More sharing options...
N-Bomb(Nerd) Posted September 16, 2009 Author Share Posted September 16, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/174431-solved-problem-parsing-file/#findComment-919377 Share on other sites More sharing options...
dreamwest Posted September 16, 2009 Share Posted September 16, 2009 try encoding your page as UTF-8 (basically Unicode) Quote Link to comment https://forums.phpfreaks.com/topic/174431-solved-problem-parsing-file/#findComment-919384 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.