Article View: free.it.visual-basic
Article #1741Problema con lo Streamreder di .NET
From: mario
Date: Tue, 02 Mar 2004 10:11
Date: Tue, 02 Mar 2004 10:11
68 lines
2195 bytes
2195 bytes
La seguente funzione VB.NET :
Private Sub AggiustaTxtSAP(ByVal sNomeFileTXTInput As String, ByVal
sNomeFileTXTOutput As String)
Dim sw As StreamWriter
Try
If File.Exists(sNomeFileTXTOutput) = False Then
sw = File.CreateText(sNomeFileTXTOutput)
sw.Flush()
sw.Close()
End If
sw = File.AppendText(sNomeFileTXTOutput)
Dim sr As StreamReader = File.OpenText(sNomeFileTXTInput)
Dim s As String
Do While sr.Peek() >= 0
s = sr.ReadLine()
s += Space(iLungRecord - s.Length)
sw.WriteLine(s)
Loop
sr.Close()
sw.Flush()
sw.Close()
Catch E As Exception
Console.WriteLine(E.Message)
End Try
End Sub
mi provoca un errore semantico di questo tipo. La stringa:
DONA�
viene convertita in:
DONA
quin di si perde il carattere �.
Come posso ovviare al problema?
Il problema sembra esserci a loivello dell'istruzione:
s = sr.ReadLine()
Grazie a chi sapr� e vorr� rispondermi.
Technical Details
Message-ID:
<c21mk3$mvb$1@panco.nettuno.it>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-05!sn-xit-09!supernews.com!129.250.16.78.MISMATCH!peer1.stngva01.us.to.verio.net!news.verio.net!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!tiscali!newsfeed1.ip.tiscali.net!news-out.tin.it!news-in.tin.it!newsfeed.nettuno.it!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: f94ee,d71d1ef9c3153740,start X-Google-Attributes: gidf94ee,public X-Google-ArrivalTime: 2004-03-02 02:11:16 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-05!sn-xit-09!supernews.com!129.250.16.78.MISMATCH!peer1.stngva01.us.to.verio.net!news.verio.net!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!news.tele.dk!small.news.tele.dk!tiscali!newsfeed1.ip.tiscali.net!news-out.tin.it!news-in.tin.it!newsfeed.nettuno.it!not-for-mail From: "mario" <mario.barbieriNOSPAM@email.it> Newsgroups: free.it.visual-basic Subject: Problema con lo Streamreder di .NET Date: Tue, 2 Mar 2004 11:11:12 +0100 Organization: NETTuno Lines: 70 Message-ID: <c21mk3$mvb$1@panco.nettuno.it> NNTP-Posting-Host: metrrej0.customer.nettuno.it X-Trace: panco.nettuno.it 1078222275 23531 130.186.250.7 (2 Mar 2004 10:11:15 GMT) X-Complaints-To: abuse@nettuno.it NNTP-Posting-Date: 2 Mar 2004 10:11:15 GMT X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165