Mobile Application Error when loading from stream

做~自己de王妃 提交于 2019-12-22 12:08:12

问题


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]))));
       contacto.Nombre := Copy(Linea[1], 1 ,Length(Linea[1]));
       GDListaContactos[pos] := contacto;
     end;
  end;
  SortContactsName;
  FicheroEntero.Free;
  Linea.Free;
  rs.Free
 Except
   on E: Exception do
   begin
     ShowMessage('Error: '+e.ToString);
     FicheroEntero.Free;
     Linea.Free;
     rs.Free
    end;
 end;
end;

来源:https://stackoverflow.com/questions/23810909/mobile-application-error-when-loading-from-stream

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!