Character varieties of surface groups