Cleanup dot and json

 - Ensure that json and dot output are always Unicode.
 - Apply proper quoting to DOT output.
 - Remove duplicated to_dot conversion in DirectedGraph.