Bonjour,
Lorsque les fichiers textes (.txt) sont lus, les caractères avec des accents sont remplacés par des petits carrés. Peut-on remédier à cela?
On m'a dit qu'il fallait modifier l'encodage.

Voici tout mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
Public Class Form1
    Dim destination As String
    Dim selection As String
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
 
    End Sub
 
    Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
        selection = ListBox1.SelectedItem
        If selection = ("Collier d'ours") Then
            destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\collierdours.txt")
        End If
        If selection = ("Cape du mage Tanzou") Then
            destination = (Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\objet\cape du mage tanzou.txt")
        End If
        Dim stream As New System.IO.StreamReader(destination)
        Dim description = stream.ReadLine
        Label1.Text = description
        Dim effet = stream.ReadLine
        Label2.Text = effet
        Dim prix = stream.ReadLine
        Label3.Text = prix
        stream.Close()
 
    End Sub
 
    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
 
    End Sub
End Class
Mais où je dois mettre l'encodage?

Encore une dernière question pour terminer:
Pour ajouter une valeur à un fichier .txt (c'est à dire: si le contenu est 5 et je veux ajouter 5 pour que ca fasse 10), j'utilise ce code:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
Dim [] As New System.IO.StreamReader(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\stats\[].txt")
            Dim () = [].ReadToEnd
            Label?.Text = ()
            [].Close()
            Kill(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\stats\[].txt")
            Dim [] As New System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\Zune\stats\[].txt")
            [].WriteLine(Label[].Text + [])
            [].Close()
Mais n'y a t'il pas un moyen plus simple de le faire?