[annotator-dev] Handling Escape Sequences

PRATHIKSHA S R prathikshasr004 at gmail.com
Thu Jul 30 07:03:42 UTC 2015


I am building a restful api in php to use annotator js to store annotations
in my own mysql database.
When I create an annotation across paragraphs, I get the json shown below :
 {"ranges":[{"start":"/p[1]","startOffset":0,"end":"/p[2]","endOffset":10}],"quote":"hjshdjkhfjkhcncjkhjfdhfjhdjfkjfjdhkfjhdf\\n\\t\\t\\n\\t\\t\\n\\t\\thjhcnjxcnj","text":"hjs","uri":"/annotations/api"},
referer: http://localhost/case/1

I store this json in mysql database. When I retrieve this annotation on a
GET request, I get the json given below with the error "Sorry we could not
search the store" :
 {"rows":[{"ranges":[{"start":"/p[1]","startOffset":0,"end":"/p[2]","endOffset":10}],"quote":"hjshdjkhfjkhcncjkhjfdhfjhdjfkjfjdhkfjhdf\n\t\t\n\t\t\n\t\thjhcnjxcnj","text":"hjs","uri":"/annotations/api","id":1438239063}]},
referer: http://localhost/case/1

Annotator expects \\n instead of \n. But mysql escapes it, giving \n on
retrieval. How do I solve this problem? Kindly help.

Thank you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/annotator-dev/attachments/20150730/8f01017f/attachment-0003.html>


More information about the annotator-dev mailing list