If this has to be an offense at all, the penalty should be community service (which he's doing anyway), and not jail time. He wasn't doing anything threatening or violent, and jails are overcrowded.
However, this whole thing evades the real problem, and that's urban homelessness. The city needs to address the root problem and get the homeless people into homes, shelters, or hospitals, where they will also be fed. People living on the streets is not a good environment for anyone.
It's not healthy or safe for the homeless people, and it's not healthy or safe for the residents.