blubsy Posted December 28, 2010 Share Posted December 28, 2010 Bonjour, je suis entrain de terminé mon application et j'ai besoin de récupéré des données enregistré dans un fichier txt uploader sur la carte SD. Dans le principe cela fonctionne sans problème. Cependant lorsque le fichier contines certain caractères spéciaux comme des accents je me retrouve avec des tas de hyérogliphe. Je pensais que l'UTF-8 m'aurait permis de réglé ce problème mais rien n'y fait. Quelqu'un auraitil une idée du problème ? Merci par avance pour votre aide. Blubsy try { FileInputStream fis = new FileInputStream("/sdcard/mysdfile.txt"); InputStreamReader tempInputStreamReader = new InputStreamReader(fis); String filePath = "/sdcard/mysdfile.txt"; //String UTF8 = "UTF-8"; String UTF8 = tempInputStreamReader.getEncoding(); int BUFFER_SIZE = 8192; BufferedReader myReader = new BufferedReader(new InputStreamReader(new FileInputStream("/sdcard/mysdfile.txt"), UTF8),BUFFER_SIZE); String aDataRow= ""; String aBuffer= ""; while((aDataRow= myReader.readLine()) != null) { aBuffer+= aDataRow+ "\n"; } txtData.setText(aBuffer); myReader.close(); Toast.makeText(getBaseContext(),"Lecture du fichié SD 'mysdfile.txt'", 1).show(); }catch (FileNotFoundException e){ }catch (UnsupportedEncodingException e){ }catch (IOException e) { } Link to comment Share on other sites More sharing options...
Kricek Posted February 15, 2011 Share Posted February 15, 2011 Coucou! Je ne sais pas si ton souci est réglé mais, au cas où: A mon avis, un ptit aDataRow = aDataRow.replace("é","e"); aDataRow = aDataRow.replace("è","e"); aDataRow = aDataRow.replace("à","a"); ... ... ... ca devrait le faire... Sinon, ajoute "[Résolu]" au début du titre de ton sujet... ;) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.