I am reading a line from an xml file stored on an SD card that has some carriage returns stored with the escape sequence "\ n". For instance,
<string mystring="Line1\nLine2">
But when I show the text in the emulator, \ n appears instead of creating a new line. I am not doing anything unusual in the text, just reading it with SAXParser and then adding it to the text box. Is there a parameter that I need to check to make sure the newlines are displayed correctly? Do I need to save the carriage differently in the xml file?
I tried \ r \ n too, and this does not work either. When I debug, I see that an extra \ is placed in front of the existing \ I see that in my startElement SAX method, the line
String s = atts.getValue("mystring");
assigns "Line1 \ nLine2" to s, so the problem is with SAXParser.
source
share