G guenneguez_t Member Licensed User Longtime User Feb 21, 2019 #1 Hi, I want to load a file encode in ANSI and use data to populate Spinner. There is a charactère with accent. Join a sample file. How can I do ? Regard's Thomas Attachments EPREUVE.txt EPREUVE.txt 265 bytes · Views: 555
Hi, I want to load a file encode in ANSI and use data to populate Spinner. There is a charactère with accent. Join a sample file. How can I do ? Regard's Thomas
Erel B4X founder Staff member Licensed User Longtime User Feb 21, 2019 #2 Please edit the thread title. It should be in English (or post it in the language specific forum). Upvote 0
klaus Expert Licensed User Longtime User Feb 21, 2019 #4 1. Change the encoding to URF-8, if this file is only one original file which you don't reuse as it is. You can di it with notapad++. 2. You can use TextReader with TextReader.Initialize2(File.OpenInput(File.DirAssets, "EPREUVE.txt", "Windows-1252"). Then you can : - Read the whole text with TextReader.ReadAll - Read line by line with TextReader.ReadLine, something like this: Code: Copy Private txr As TextReader txr.Initialize2(File.OpenInput(File.DirAssets, "EPREUVE.txt"), "Windows-1252") Private line As String line = txr.ReadLine Do While line <> Null Log(line) line = txr.ReadLine Loop - Read a List with TextReader.ReadList Be aware that if you need to save the file again with ANSI you would need to use TextWriter. This is explained in the B4X Basic Language booklet chapter 4.12.6 Text encoding. Et c'est aussi expliqué en français dans le livret B4X Langage Basic chapitre 4.12.6 Encodage de texte. Last edited: Feb 21, 2019 Upvote 0
1. Change the encoding to URF-8, if this file is only one original file which you don't reuse as it is. You can di it with notapad++. 2. You can use TextReader with TextReader.Initialize2(File.OpenInput(File.DirAssets, "EPREUVE.txt", "Windows-1252"). Then you can : - Read the whole text with TextReader.ReadAll - Read line by line with TextReader.ReadLine, something like this: Code: Copy Private txr As TextReader txr.Initialize2(File.OpenInput(File.DirAssets, "EPREUVE.txt"), "Windows-1252") Private line As String line = txr.ReadLine Do While line <> Null Log(line) line = txr.ReadLine Loop - Read a List with TextReader.ReadList Be aware that if you need to save the file again with ANSI you would need to use TextWriter. This is explained in the B4X Basic Language booklet chapter 4.12.6 Text encoding. Et c'est aussi expliqué en français dans le livret B4X Langage Basic chapitre 4.12.6 Encodage de texte.