Formal writing insists upon proper grammar and syntax; however, when quoting someone remember the rule:
Thou shall not edit quotes
According to Washington Post's business chief copy editor, Bill Walsh, “a reader should be able to watch a TV interview and read the same interview in the newspaper and not notice the discrepancies in word choice.”
My roommate showed me a quote today that I will use as an example:
“My man would still be living if they'da did they job like they was supposed to …”
“Quotes are sacred,” Walsh also points out, and the syntax should not be changed to sound formal if it is not–and in the same breath (or stroke of they keyboard) an “educated person” who may say “ya'll” or “ain't” should not be edited to have said “you all” or “are not” to make them look better.
In the case of a “should of” for should have or “I dunno” for I don't know, it is acceptable to spell the words properly as a story shouldn't try to re-create a dialect.
Source: Bill, Walsh,. Lapsing into a comma: a curmudgeon's guide to the many things that can go wrong in print–and how to avoid them. (Chicago), Ill: Contemporary, 2000.