timothyjgraham
timothyjgraham

Reputation: 1232

Cannot write igraph object to file (forbidden control character error)

When trying to write an igraph object to file, I receive the following error:

Error in .Call("R_igraph_write_graph_graphml", graph, file, as.logical(prefixAttr), : At foreign-graphml.c:1236 : Forbidden control character 0x08 found in igraph_i_xml_escape, Invalid value

I am using the basic syntax for writing igraph objects to file in graphml format:

write.graph(myGraphObject,"graph_object_to_file.graphml",format="graphml")

I have tried converting all the character vector attributes of the graph to UTF-8 using the iconv function, however it has not worked so far.

Any ideas much appreciated.

Upvotes: 0

Views: 387

Answers (1)

Tamás
Tamás

Reputation: 48071

Find the character attribute that contains a character with character code 0x08, and fix it. That character stands for Backspace in the ASCII table, so I'm pretty sure that this is not meant to be there. Also, that character is disallowed in XML 1.0 anyway, so you won't be able to save it into an XML 1.0 file.

Converting to UTF-8 won't work because the UTF-8 equivalent of 0x08 is also 0x08.

Upvotes: 3

Related Questions