I have a text file with the following content:
\n==================\0No. 4♨ ==\n \n✅IHappy Holi\n✅Ground Floor or Second Floor\n9910080224\nemailaddress@gmail.com
I have a python code running in the server to find the indices which I want to pass with the text for the highlighting purposes on the client. Following is the code for that:
import re
f = open('data.json', 'r')
text = f.readline().strip().decode('UTF-8').encode('UTF-8')
f.close()
for m in re.finditer(r'emailaddress', text, flags=re.IGNORECASE):
s = m.start()
e = m.end()
print s, e
print text[s:e]
The output is:
123 135
emailaddress
Now on the client side, I have the java code (on android). HOwever these indices dont work at all.
public class HelloWorld {
public static void main(String[] args) {
String text = "\n==================\0No. 4♨ ==\n \n✅IHappy Holi\n✅Ground Floor or Second Floor\n9910080224\nemailaddress@gmail.com";
System.out.println(text.substring(**115**));
}
}
And the output is:
l.com
I am sure I am making some mistake in the encoding of the strings. Can someone help me with that.