ADNSil Posted March 12, 2009 at 11:33 AM Report Share #250187 Posted March 12, 2009 at 11:33 AM Boas preciso de uma ajudinha... em relação aos acentos numa leitura de ficheiro .txt para uma textbox... então é o seguinte: retiro um email do outlook para uma RichTextBox.Text e aparece assim: " testa la essa tua coisa _____ Conheça já o Windows Live Spaces, o site de relacionamentos do Messenger! HYPERLINK "h**p://www.amigosdomessenger.com.br"Crie já o seu! " guardo no ficheiro .txt e fica exactamente =. mas quando vou ler do ficheiro .txt para a RichTextBox.Text aparece-me desta forma: ? " testa la essa tua coisa  _____  Conheça já o Windows Live Spaces, o site de relacionamentos do Messenger! HYPERLINK "h**p://www.amigosdomessenger.com.br"Crie já o seu! " que posso eu fazer ?? Link to comment Share on other sites More sharing options...
Hellblazer Posted March 12, 2009 at 11:37 AM Report Share #250189 Posted March 12, 2009 at 11:37 AM Como estas a ler o ficheiro? quando les tens de alterar o encoding 👍 There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
ADNSil Posted March 12, 2009 at 12:27 PM Author Report Share #250220 Posted March 12, 2009 at 12:27 PM este é o código que estou a usar. da-me mais algumas dicas desse tal encoding se for relacionado com o código que te mostrei. se não agradecia uma solução 🙂 Dim vPass As Boolean = False Dim vMnumero As String = "->" & ListBox_de.SelectedIndex + 1 & "<-" Dim vLerDados As Integer = 0 'variaveis para receber o valor dos emails Dim vCorpo As String = "" 'Cria um array, colocando o conteúdo de cada linha em indexs diferentes Dim Linha() As String = Strings.Split(My.Computer.FileSystem.ReadAllText(vFdir, System.Text.Encoding.Default), ControlChars.CrLf) For i As Integer = 0 To Linha.Length - 1 'Se não estiver vazia... If Linha(i) <> "" Then If (vMnumero = Linha(i)) Then vPass = True End If If vPass = True Then 'Lê o Conteúdo, controla e grava na variavel If (vLerDados = 1) And Not (Linha(i) = "Corpo fim") Then vCorpo = vCorpo & Linha(i) & vbCrLf End If If (vLerDados = 2) Then 'Escreve o texto nos campos .text CorpoRichTextBox.Text = vCorpo Exit For 'Verifica o conteúdo End If If (Linha(i) = "Corpo inicio") Then vLerDados = 1 ElseIf (Linha(i) = "Corpo fim") Then vLerDados = 2 End If End If End If Next Link to comment Share on other sites More sharing options...
Hellblazer Posted March 12, 2009 at 12:31 PM Report Share #250223 Posted March 12, 2009 at 12:31 PM utiliza UTF8Encoding There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
ADNSil Posted March 12, 2009 at 01:05 PM Author Report Share #250244 Posted March 12, 2009 at 01:05 PM ooo, não sei como usar isso, podes me explicar sff e dar um exemplo... nem sei se tenho de usar o UTF8Encoding para ler e escrever ou só para ler ou só escrever lolol vou investigar, se poderes ajudar agradeço. 🙂 enquanto isso vou ver se encontro alguma coisa também ? Link to comment Share on other sites More sharing options...
Hellblazer Posted March 12, 2009 at 02:02 PM Report Share #250258 Posted March 12, 2009 at 02:02 PM My.Computer.FileSystem.ReadAllText("C:teste.txt", System.Text.Encoding.UTF8) Grava tambem em UTF8 e melhor 🙂 There are two ways to write error-free programs; only the third one works. Link to comment Share on other sites More sharing options...
jpaulino Posted March 12, 2009 at 09:37 PM Report Share #250394 Posted March 12, 2009 at 09:37 PM My.Computer.FileSystem.ReadAllText("C:teste.txt", System.Text.Encoding.UTF8) Grava tambem em UTF8 e melhor 🙂 @ADNSil, Tenho tido melhores resultados utilizando o encoding default. É uma questão de experimentares e veres os resultados. Link to comment Share on other sites More sharing options...
ADNSil Posted March 17, 2009 at 04:09 PM Author Report Share #251278 Posted March 17, 2009 at 04:09 PM Obrigado pela ajuda Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now