Encoding Converter Windows Application (C#.NET)

Encoding Converter ThumbnalesThis application is a very easy to use and a very small tool. It is used to convert a text file encoded using one encoding to the text file encoded using user specified encoding.

Application reads file data into a byte array and converts that byte array from one givven encoding to another. Application uses System.Text namespace and it’s class – Encoding, to perform this action.

Application requires Microsoft .NET framework to run.

It supports anny encoding supported by Microsoft .NET framework. The application was tested with windows-1257, windows-1251 and utf-8 encodings.

Please report any bug’s or suggestions related to this easy application.

The C#.NET source code is:
[code lang=”cpp”]
try
{
if (inputF.ShowDialog()==DialogResult.OK)
{
FileStream fs=File.OpenRead(inputF.FileName);
byte[] bytes=new byte[fs.Length];
fs.Read(bytes,0,(int)fs.Length);
fs.Close();
Encoding inputEnc=Encoding.GetEncoding(enc.Text);
Encoding outputEnc=Encoding.GetEncoding(outEnc.Text);
byte[] decoded=Encoding.Convert(inputEnc,outputEnc,bytes,0,bytes.Length);
if (outputF.ShowDialog()==DialogResult.OK)
{
FileStream fw=File.OpenWrite(outputF.FileName);
fw.Write(decoded,0,(int)decoded.Length);
fw.Close();
}
}
Status.Text=”Status: “+ “Input file: “+inputF.FileName+” converted”;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
[/code]

https://i0.wp.com/are.ehibou.com/wp-content/plugins/downloads-manager/img/icons/default.gif?w=525 download: EncodingConverterSrc.zip ()
added: 30/07/2010
clicks: 690
description: Encoding Converter Source

https://i0.wp.com/are.ehibou.com/wp-content/plugins/downloads-manager/img/icons/default.gif?w=525 download: EncodingConverter.zip ()
added: 30/07/2010
clicks: 705
description: Encoding Converter binary

7 Replies to “Encoding Converter Windows Application (C#.NET)”

  1. Rather than having me type in the names of the encoding, how about detecting all encodings supported by the system and providing a drop down box?

  2. I need to do conversion of thousands files from 1251 to utf8 encoding. Is it possible to use your tool from command prompt using wildcards or list of files as input parameter or in other batch mode?

  3. If you need command line tool to do this I could easily change my application to do this for you … But please donate something … Or you can download source code and you can change it to your needs …

Leave a Reply