Thank you, guys. Your help didn't solve the problem, but it actually helped me to get closer to the real place of the problem. I did a lot more tests and found out that the problem was in the interface between java and apache. Doing the search with 'grep' works just fine. Then it came to me the possibility that the java was itself messing things up. So I put a "LANG=pt_BR.UTF-8" before the java command and finally the problem was solved! Oh, I'm tired... Do you think it deserves a Meditation?