I'm porting a open source game client from PC to Android, however when dealing with NPC chat, some lines are not parsed correctly:
Original text from server:
formatted_text_ = "Now...ask me any questions you may have on traveling!!\r\n#L0##bHow do I move?#l\r\n#L1#How do I take down the monsters?#l\r\n#L2#How can I pick up an item?#l\r\n#L3#What happens when I die?#l\r\n#L4#When can I choose a job?#l\r\n#L5#Tell me more about this island!#l\r\n#L6#What should I do to become a Warrior?#l\r\n#L7#What should I do to become a Bowman?#l\r\n#L8#What should I do to become a Magician?#l\r\n#L9#What should I do to become a Thief?#l\r\n#L10#How do I raise the character stats? (S)#l\r\n#L11#How do I check the items that I just picked up?#l\r\n#L12#How do I put on an item?#l\r\n#L13#How do I check out the items that I'm wearing?#l\r\n#L14#What are skills? (K)#l\r\n#L15#How do I get to Victoria Island?#l\r\n#L16#What are mesos?#l#k"
Second line "How do I move" is not started as a new line, other lines ended with \r\n are parsed normally by following a new line.
How \r and \n are handled:
switch (text[first]) { case '\\': if (first + 1 < last) { switch (text[first + 1]) { case 'n': linebreak = true; break; case 'r': linebreak = ax_ > 0; break; } skip++; } skip++; break;