Android Question String returned by Spinner - char added

verolet

New Member
For information, the string returned by the SelectedItem function when you select an item in a Spinner (previously filled with a .txt file UTF8 encoded) has a particularity : a char is automaticaly added at the beginning of the string (ASCII code 63 - ?).
This char doesn't appear (in debugger for example), but it's here (string lenght is +1) and made unable string comparaison.
You must remove this char with simple :
txt = txt.SubString(1)
 
Of course.
I've re-encoded the SelectedItem in ASCII to view the "invisible" first char, but before that, i'm sure that the length is +1.
 

Attachments

Upvote 0
Your file is encoded in UTF8 with BOM (byte order mark). You should encode it in UTF8 without BOM or skip the three first bytes.

SS-2014-07-07_08.30.22.png
 
Upvote 0
Back
Top