The general rule is simply: Ask! Dress code varies a lot between companies, and depends on many aspects, such as company culture, local culture, culture of the business sector (banking vs IT vs manufacturing), job description...
So in general it is perfectably acceptable to ask about the dresscode. Typically you'd do it during the phone screen (if there is one), or in response to the interview invitation. Asking should not be counted against you, on the contrary, it shows that you want to be well prepared.
That said, here is my personal rule of thumb for a "compromise outfit" for a man. I'm from Germany, but this should be ok at least for most of Europe.
- nice leather shoes (but not shiny)
- fancy trousers (like you'd wear with a suit)
- dress shirt in a standard color (white or light blue)
To make it slightly more formal, add
This outfit is nicely in the middle between informal style (jeans and t-shirt) and formal (business suit with tie). That way, it will not look hopelessly overdressed in a jeans-and-tshirt place, and will still at least show you made an effort to dress up, even if they expected a proper suit.
Still, the best option is to just ask.