Representation varieties of the fundamental groups of compact orientable surfaces