Line break (n) not working in ios when escaped via StringEscapeUtils.escapeJava

Line break (n) not working in ios when escaped via StringEscapeUtils.escapeJava



I am using compile 'org.apache.commons:commons-lang3:3.4' library to show emoji in ios app so in my android app to encode string into unicode i am using this method StringEscapeUtils.escapeJava its working fine emoji sent via android app showing in ios but when i entered the data which some line break, in ios it shows n instead of showing text in new line.I tried


compile 'org.apache.commons:commons-lang3:3.4'


unicode


StringEscapeUtils.escapeJava


n


val actualText=editText.text.toString()
val oldText=StringEscapeUtils.escapeJava(actualText).toString()
val newText=oldText.replace("n", "rn")



but its not working.





Why rn? Apple has long been using n as newline.
– Eugen Pechanec
Aug 21 at 8:56


rn


n




1 Answer
1



After struggling a lot i found the issue.
for these statements:


val actualText=editText.text.toString()
val oldText=StringEscapeUtils.escapeJava(actualText).toString()
val newText=oldText.replace("n", "rn")



This picture(output) will clear everything



enter image description here



after using StringEscapeUtils.escapeJava for old text n not considered as escape sequence character. So i changed replacement statement to:


val reviewText=oldText.replace(StringEscapeUtils.escapeJava("n"), "rn")



and then output is:



enter image description here



after this in ios app instead of showing n it shows text to the new line.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế