I have created an sqlite database and imported data from csv as UTF-8. It shows some unknown characters like �
. In my android code i have managed this with regular expressions. Now I have problem with \n
. My regular expression not detecting \n
and it will replace \
and n
will be there.
Pattern pattern = Pattern.compile("[^a-zA-Z0-9$' '-:|,&.\"\"()\n]");
Matcher matcher = pattern.matcher(descriptionfromDb);
String description = matcher.replaceAll("");
I have also tried using android Html.fromHtml
and Spannable
and both are not escaping the �
symbol and \n
not get converted to new line.
Try this:
description = description.replaceAll(System.getProperty("line.separator"), "");
For special characters see this answer: How to define special characters in array implementing java Application?
Code for Question mark is ?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With