A man born in 1830 in Sweden with a father named Charles (which would most likely have been Carl or Karl; Charles was rarely used) would have had the patronymic last name of Carlsson (Karlsson) which means son of Carl/Karl something else. Andersson means son of Anders. Perhaps the father was an Andersson but patronymics were still quite strong in 1830.
Andersen is a spelling used in Denmark or Norway, by the way. Swedes used the son ending.