The cheapest solution to avoid roaming charges, but a cumbersome one, may be to buy a prepaid 'dongle' for the countries you visit most often, and top it up as needed. It's practical if you have several countries you visit regularly, but not if your travels take to many places on a one-off basis.
By the way, using private wifi connections, even if the owners are foolish enough to leave them unencrypted, is illegal in some countries. That said ..... yep!