Mobile Application Error when loading from stream

  

By elcharlie I’m doing my first application for mobile in delphi and I have a problem and can not fix it.

I have a procedure running in which I load a csv file from the resource.
When I throw this procedure, on a mobile device (I could only test it on Android) I get this error: ‘No mapping for the Unicode character exists in the Target multi-byte code page’, no error in 32-bit Windows.

Here is the code, Rad Studio XE6:

procedure TContactos.LoadFromResource;
var
FicheroEntero, Linea: TStringList;
rs: TResourceStream;
I, pos: Integer;
contacto : TContacto;
begin
FicheroEntero := TStringList.Create;
Linea := TStringList.Create;
try
rs := TResourceStream.Create(HInstance,’clientes_csv’, RT_RCDATA);
FicheroEntero.LoadFromStream(rs); //Here enter in Exception
for I := 1 to FicheroEntero.Count-1 do
begin
Linea.Delimiter := ‘;’;
Linea.StrictDelimiter := True;
Linea.DelimitedText := FicheroEntero[I];
if Linea.Count >= 2 then
begin
contacto := TContacto.Create;
pos := GDListaContactos.Add(contacto);
contacto.Posicion := pos;
contacto.Codigo := StrToInt(Trim(Copy(Linea[0], 1 ,Length(Linea[0]))));
…read more

Via: StackOverflow

Comments are closed.