Il .NET Framework e l'encoding

Daniele Bochicchio

di Daniele Bochicchio, in .NET Framework, mercoledì 18 febbraio 2004 ore 15.35

Archiviato in:

Negli ultimi 2-3 giorni su newsgroup ed in privato hanno più volte chiesto il perchè della mancanza delle lettere accentate durante la lettura di file di testo (ma in generale questo vale per qualsiasi oggetti che erediti dalla classe Stream). Qui trovate alcune richieste ed alcune risposte.

Il motivo è semplice: molti indicavano un encoding errato, in molti casi UTF8, mentre il bello della classe Stream è proprio la sua capacità di leggere flussi con encoding differenti.

Morale della favola? Basta usare Encoding.Default (o Encoding.GetEncoding("iso-8859-15")) perchè tutto funzioni. Si trovano nel namespace System.Text.

(Lo scrivo anche perchè in questo modo in futuro possa postare direttamente il link e risparmare qualche battuta sulla tastiera :))

Commenti

Per inserire un commento, devi avere un account.

Fai il login e torna a questa pagina, oppure registrati alla nostra community.



Segnala su: Facebook MSDN Social Twitter Segnalo Wikio Diggita Technorati Stumbleupon Google Yahoo FriendFeed Delicious Furl

Nella stessa categoria
I più letti del mese
TagCloud
.NET Framework, .NET Framework 2.0, .NET Framework 3.0, .NET Framework 3.5, .NET Framework 4.0, 10annidi, ADO.NET, ADO.NET Data Services, ADO.NET Entity Framework, AJAX, Architettura, ASP, ASP.NET, ASP.NET 2.0, ASP.NET 2.0 per tutti, ASP.NET 3.5, ASP.NET 3.5 per tutti, ASP.NET 4.0, ASP.NET AJAX, ASP.NET Charting, ASP.NET MVC, ASPItalia.com, Cache, CSS, Custom Control, Database, Databinding, Datagrid, Deployment, Dynamic Data Control, HttpHandler, HttpModule, HttpRuntime, IIS, ISAPI, Javascript, LINQ, LINQ to Entities, LINQ to SQL, LogParser, Master Pages, Media Center, Membership API, Microsoft Expression, Mono, MySQL, Object Oriented Programming, Off Topic, Office, ORM, Pattern, PDC 2008, Profile API, Provider Model, Report, Roles API, Security, Silverlight, Silverlight 2.0, Silverlight 3.0, SQL Server, User Control, Visual Studio, Web Service, Windows 7, Windows CardSpace, Windows Client, Windows Communication Foundation, Windows Live Services, Windows Mobile, Windows Presentation Foundation, Windows Server, Windows Vista, WinFS, XAML, XBox 360, XHTML, XML, XSLT
BLOG INFO
  • 889 post, 388 commenti, 187 trackback
  • Feed blog e contenuti tecnici: RSS
  • Feed blog: RSS Atom
IN EVIDENZA