Android Sqlite Special Characters

I created a sqlite database and imported data from csv as UTF-8. It shows some unknown characters, such as . In my Android code, I dealt with regular expressions. Now I have a problem with \n. My regex is not detecting \nand it will replace \and n.

Pattern pattern = Pattern.compile("[^a-zA-Z0-9$' '-:|,&.\"\"()\n]");
Matcher matcher = pattern.matcher(descriptionfromDb);
String description = matcher.replaceAll("");

I also tried using android Html.fromHtmland Spannable, and both do not escape the character , and \ndo not convert to a new line.

+5
source share
1 answer

Try the following:

description = description.replaceAll(System.getProperty("line.separator"), "");

. : , java-?

- ?

+2

All Articles