The question really is whether SF has more dodgy areas than average, and I guess the answer is yes. I've been a couple of times, and it was a long time ago, but some very central areas felt a bit too unsafe even during the day.
(This probably used to be somewhat true of the Javits in NYC but that whole area of the city has generally gentrified with the Hudson Yards project being the latest big change.)
A homeless guy on a street full of druggies near Frankfurt hbh asked for a euro and I said no I can't help you. He walked directly to a spot nearby where he kept a knife, and brandishing the knife, he paced towards me. I put my back to the wall of a nearby building and watched as he approached. About 10 meters from me his friend intervened and talked him down. He walked away instead of assaulting me.
I still think Oslo is incredibly safe, but shit happens anywhere
Saying that Europe is super safe compared to the US isn't really accurate or nuanced enough. I'd agree with homicides but most of those involve gangs fighting over turf and not random victims.