Android Question What character is this? (SOLVED) ASCII 13

MaxWaterfall

Member
Licensed User
Okay, here's my problem. I have a Visual Studio application that sends SMTP mails to a gmail account. I then used a POP3 to read the mails from this gmail account in my mobile application. The mobile application reads the email using the MailParser. However the email is not fully parsed. This is not a problem as I can just simply remove the remaining unwanted strings from the mail using mail.Replace(..). The problem is is that there is a character I cannot remove, because I don't know what it is. The characters creates a new line but not in the logs. It looks like space or new line but I have already tried the following to remove it:

B4X:
       mail = mail.Replace(" ","")
                 mail = mail.Replace(CRLF, "")
                 mail = mail.Replace("", "")
                 mail = mail.Replace(Null, "")
                 mail = mail.replace(TAB, "")
                 mail = mail.Replace("[NL]", "")
                 mail = mail.Replace(Chr(9), "")

I will show you what's going on:

1:pepsi=0D=0A2:7Up=0D=0A3:Water=0D=0A4:Tango=0D=0A5:Coke=0D=0A6:=0D=0A=
7:=0D=0A8:=0D=0A9:=0D=0A10:powerade=0D=0A11:=0D=0A12:=0D=0A13:=0D=0A=
14:=0D=0A15:=0D=0A16:Coffeeeeeeee=0D=0A17:Hot Chocolate=0D=0A18:=0D=0A=
19:=0D=0A20:=0D=0A21:=0D=0A22:=0D=0A23:=0D=0A24:=0D=0A25:=0D=0A26=
:=0D=0A27:=0D=0A28:=0D=0A29:=0D=0A30:=0D=0A31:Sandwhich=0D=0A32:A=
pple=0D=0A33:=0D=0A34:=0D=0A35:=0D=0A36:=0D=0A37:=0D=0A38:=0D=0A3=
9:=0D=0A40:=0D=0A41:=0D=0A42:=0D=0A43:=0D=0A44:=0D=0A45:=0D=0A46:=
Giant Pizza=0D=0A47:=0D=0A48:=0D=0A49:=0D=0A50:=0D=0A51:=0D=0A52:=
=0D=0A53:=0D=0A54:=0D=0A55:=0D=0A56:=0D=0A57:=0D=0A58:=0D=0A59:=0D=0A=
60:=0D=0A

This is how the mail originally looks.
Then I do the following code:

B4X:
       mail = mail.Replace("=0D=0A", "")
                 mail = mail.Replace("=0D=0A=", "")
                 mail = mail.Replace("=", "")
                 mail = mail.Replace(" ","")
                 mail = mail.Replace(CRLF, "")
                 mail = mail.Replace("", "")
                 mail = mail.Replace(Null, "")
                 mail = mail.replace(TAB, "")
                 mail = mail.Replace("[NL]", "")
                 mail = mail.Replace(Chr(9), "")
The mail then looks like this:

1:pepsi2:7Up3:Water4:Tango5:Coke6:
7:8:9:10:powerade11:12:13:
14:15:16:Coffeeeeeeee17:HotChocolate18:
19:20:21:22:23:24:25:26
:27:28:29:30:31:Sandwhich32:A
pple33:34:35:36:37:38:3
9:40:41:42:43:44:45:46:
GiantPizza47:48:49:50:51:52:
53:54:55:56:57:58:59:
60:

The string should be a straight line? But it isn't. In the logs it's one long line of text. But when I paste it into a text file it looks like it does above. If I search for the index of (x & ":") and x = 26, it returns -1 (false) because of that character. Any ideas what it is? Or how to remove it? Again in the logs the text is in one straight line. Any help would be greatly appreciated.

Thanks, Max

P.S. Excuse the smiley's in the text :D
 

Cableguy

Expert
Licensed User
The Smiley's are to be replaced by the letter "P".
Have you tried an hex reader? This way you can see the hex code for the file and try to find the code for the character. Don't know if an ASCII reader exists...
 

stevel05

Expert
Licensed User
You could do:
B4X:
For i = 0 to mail.Length - 1
    Log(Asc(Mail.CharAt(i)))
Next
To find out what the value of the character is.
 

MaxWaterfall

Member
Licensed User
Indeed they are! I haven't tried a hex reader but stevels idea looks like a good one. I'll try it and get back to you :)
 

MaxWaterfall

Member
Licensed User
Stevel05 you genius! Donated a little to you :) If anyone else was wandering, the character was ASCII 13, the symbol is CR.
 
Top